[Gdal-dev] help with OGR->python

Frank Warmerdam fwarmerdam at gmail.com
Fri Feb 4 16:22:51 EST 2005


On Fri, 04 Feb 2005 16:14:56 +0100, Julien Demaria <dem at acri-st.fr> wrote:
> Dylan,
> 
> The trick is that in the OGR C and Python APIs, a Geometry can contains
> others Geometries (accessible with Geometry::GetGeometryCount() and
> Geometry::GetGeometryRef( i )), and that a Polygon has not directly points,

Folks,

Juliens analysis is quite right.  But clearly it would be handy
to have more direct ways of extracting the lists of points from a
geometry without having to do so much iteration.  Perhaps we
need a method that returns the points of a geometry as a list
of point tuples.  This method could know about "walking" the
children of a geometry and build up a sort of list of lists to
match up with the geometries.  

So a polygon would have a list of rings,  each ring would be a
list of points in that ring.  Each point would be an (x,y,z) tuple. 

Howard, would you be interested in implementing such a method
on the Geometry?  Though when I think about it, it might be more 
efficient to implement it in C. 

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