[gdal-dev] proper way to get area of a lon/lat polygon

Mikhail Kruk meshko at gmail.com
Thu Sep 17 21:49:06 PDT 2020


Hi!
I am a complete GIS newbie so please bear with me...

I am trying to get the area of a polygon specified in lon,lat pairs in some
reasonable units, like sq kilometers.  My quest so far is documented here:

https://gis.stackexchange.com/questions/374428/default-geo-spatial-reference-system-in-gdal-ogr

but basically I came to the conclusion that when people talk about an area
of something on Earth they really mean the area of a projection (am i right
about that?) and so i need to specify a projection before getting a
meaningful area.  So i ended up with this code:

wkt = "POLYGON ((lon1 lat1, lon2 lat2, lon3 lat3))"
poly = ogr.CreateGeometryFromWkt(wkt)
sr = osr.SpatialReference()
sr.SetWellKnownGeogCS("NAD83")
sr.SetProjCS("SRS_PT_TRANSVERSE_MERCATOR")
poly.AssignSpatialReference(sr)
poly.GetArea()

and yet I get back a value which seems to be calculated in square degrees.

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200918/224d2e4d/attachment.html>


More information about the gdal-dev mailing list