4

I have lots of (multi)polygons generated with this tool: http://gis.ucla.edu/apps/click2shp/
It provides a zip with dbf, shp, shx, prj files. The prj file contains the following:

GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]

Which is EPSG:4326 as I understand.

Polygons are loaded to the Postgres + PostGIS database using some third party library (unknown to me). And it is accessible as WKB or WKT using SQL.
The polygons are spread all over the world - USA, Australia, Europe, potentially anywhere.

What I need is the projected coordinate system for each of these polygons to calculate their areas.

So far I've tried exploring http://www.epsg-registry.org that allows me to identify the CRS using some point or bounding box.
But maybe there's a better (preferably automated) solution.

3
  • 2
    I suggest to create a custom equal area CRS based on the centroid of each polygon, reproject the polygon to it, and caclulate the area of it.
    – AndreJ
    Apr 17, 2018 at 10:51
  • 1
    PostGIS already has a means to calculate geodetic area without reprojecting each shape in a custom equal-area projection -- ST_Area(geomcol::geography)
    – Vince
    Apr 17, 2018 at 10:56
  • 1
    If the polygons are small enough that planar geometry is accurate enough for your purposes, then you could use the UTM projection appropriate for the longitude, or maybe construct a proj4 string for a zenithal projection centred on the centroid of your polygon.
    – Spacedman
    Apr 17, 2018 at 11:58

1 Answer 1

4

@Vince (in the comments) is right, but he missed to enphasize that there is no projected coordinate system to look for, the information is geography data type, there is no way to find the projection.

You can read about this data type: https://postgis.net/docs/using_postgis_dbmanagement.html#PostGIS_Geography

So, who cares about no projection, you do not need it to get the areas of the features using ST_Area(). The man page says:

For geography, by default area is determined on a spheroid with units in square meters

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.