<div dir="ltr"><div>Hi!</div><div>I am a complete GIS newbie so please bear with me... <br></div><div><br></div><div>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:</div><div><br></div><div><a href="https://gis.stackexchange.com/questions/374428/default-geo-spatial-reference-system-in-gdal-ogr" target="_blank">https://gis.stackexchange.com/questions/374428/default-geo-spatial-reference-system-in-gdal-ogr</a></div><div><br></div><div>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:</div><div><br></div><div><pre><code><span>wkt </span><span>=</span><span> </span><span>"POLYGON ((lon1 lat1, lon2 lat2, lon3 lat3))"</span><span>
poly </span><span>=</span><span> ogr</span><span>.</span><span>CreateGeometryFromWkt</span><span>(</span><span>wkt</span><span>)</span><span>
sr </span><span>=</span><span> osr</span><span>.</span><span>SpatialReference</span><span>()</span><span>
sr</span><span>.</span><span>SetWellKnownGeogCS</span><span>(</span><span>"NAD83"</span><span>)</span><span>
sr</span><span>.</span><span>SetProjCS</span><span>(</span><span>"SRS_PT_TRANSVERSE_MERCATOR"</span><span>)</span><span>
poly</span><span>.</span><span>AssignSpatialReference</span><span>(</span><span>sr</span><span>)</span><span>
poly</span><span>.</span><span>GetArea</span><span>()<br><br></span></code></pre><pre><code><span><span style="font-family:arial,sans-serif">and yet I get back a value which seems to be calculated in square degrees</span>.<br></span></code></pre><pre><code><span><span style="font-family:arial,sans-serif">Thanks!</span></span></code></pre></div></div>