[gdal-dev] proper way to get area of a lon/lat polygon
Javier Jimenez Shaw
j1 at jimenezshaw.com
Fri Sep 18 00:31:12 PDT 2020
The documentation of AssignSpatialReference says:
"Any existing spatial reference is replaced, but under no circumstances
does this result in the object being reprojected. It is just changing the
interpretation of the existing geometry."
You have to reproject the polygon coordinates to actually have the polygon
in that CRS.
.___ ._ ..._ .. . ._. .___ .. __ . _. . __.. ... .... ._ .__
Entre dos pensamientos racionales
hay infinitos pensamientos irracionales.
On Fri, 18 Sep 2020 at 06:49, Mikhail Kruk <meshko at gmail.com> wrote:
> 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
> 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()
> and yet I get back a value which seems to be calculated in square degrees.
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the gdal-dev