[gdal-dev] get_Area() Python

Frank Warmerdam warmerdam at pobox.com
Wed Dec 9 10:01:34 EST 2009

Travis Kirstine wrote:
> Hi all,
> I'm trying a simple python script to calculate the polygon areas.  Are
> the swig bindings for python working because is returning the geometry
> type as -2147483645 the dimension and 2 for a 3d feature and the
> get_Area returns a error?
>     area = geom.get_Area()


For reasons that are not at all clear to me this method was named get_Area()
in the C++ API but elsewhere it is GetArea() (C, Python, etc).

Try geom.GetArea().

Does the geometry type not match any of the predefined values?  Note that
the OGR constants for the types are such that the 2.5D bit is the high order
bit and when viewed as a signed value it flips the values negative.  So your
value is actually wkbPolygon25D.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the gdal-dev mailing list