[FWTools] Starting with FWTool
Frank Warmerdam
warmerdam at pobox.com
Tue Mar 18 09:52:32 EDT 2008
Faizan Tayyab wrote:
> Hi,
>
> Can anyone provide me with python code (OGR) for
> reading the geometry of a polygon shapefile. I am able
> to obtain the geomerty reference but am unsure how to
> read the geometry. I am planning to use matplotlib to
> visualize the geometry.
>
> Anyone already done this????
Faizan,
I'm not aware of a direct example, but:
http://svn.osgeo.org/gdal/trunk/gdal/swig/python/samples/vec_tr.py
has logic to walk through any kind of geometry that might be helpful.
Basically, a polygon geometry will consist of a top level object that
contains one or more rings accessed using geom.GetGeometryRef(). Each
ring will contain 3 or more points accessed using GetX(), and GetY().
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 | President OSGeo, http://osgeo.org
More information about the FWTools
mailing list