[geos-devel] Converting shape files to GEOS geometries
Jean-Claude Repetto
jean-claude.repetto at worldonline.fr
Wed Jan 10 08:03:13 EST 2007
Hello list,
This is a newbie question :
I want to create GEOS geometries from data stored in ESRI shapefiles.
Shapes are composed of several shells and holes. Shells points are
clockwise, holes are counterclockwise.
I am using the GEOS C API, as recommended in the documentation at
<http://geos.refractions.net/ro/doxygen_docs/html/>.
For each part of the shapes, I have successfully created a CoordSeq,
then a LinearRing. But to create polygons (before unioning them), I need
to know :
- if a ring is a shell or a hole. In the C++ API, there is a function
called IsCCW. But how can I do the test with the C API ?
- what hole belongs to what shell. Is there a simplest method than
creating polygons for each hole and testing if they are within every
shell ? Or is it preferable to make an union of all the shells, then
remove the intersections with the holes ? (Maybe the second method
doesn't work if there are shells inside a hole).
Perhaps there is already a program or a library that can do that ?
Thanks for any help,
Jean-Claude
More information about the geos-devel
mailing list