[gdal-dev] How can I support polygons with islands in my APPLICATION USING gdal/ogr library?

sepideh sepideh.abadpour87 at gmail.com
Thu Sep 12 10:56:11 PDT 2013


MyTest.rar <http://osgeo-org.1560.x6.nabble.com/file/n5077579/MyTest.rar>  I
have uploaded my MyTest.shp created in ArcGIS. If you open it, you will see
that it has nine polygons and in the attribute table of the layer, I have
explained about the features of each polygon.  My problem is:  I'm
developing a Visual C++ MFC application with GDAL/OGR library that will show
shapefiles in an OpenGL window. And I have created this shapefile to test
some parts of my application. *My application will only support ESRI
shapefiles.*   As you know, the OGRPolygon class has only a member function
*getNumInteriorRings* and not such function for exterior rings. I mean it
supports multiple interior rings but not multiple exterior rings. So I
decided to fetch one of the rings of each polygon with *getExteriorRing()*
and the others with *getInteriorRing(int)* and decide with *isClockwise()*
method whether it is an exterior or interior ring. This approch is best for
the polygons with *FIDs : 0,1,2,3,4,5,6 * in my MyTest.shp. When I use this
code for them:  /int NumberOfInnerRings = poPolygon
->getNumInteriorRings();/  I get these results:  FID = 0 -> 5FID = 1 -> 1FID
= 2 -> 0FID = 3 -> 1FID = 4 -> 2FID = 5 -> 0FID = 6 -> 2  showing that one
of the rings has been accepted as exterior and the others as interior
polygons. You see that the polygons with the above FIDs are simple polygons,
multipart polygons and polygons with holls inside.  But for the two other
polygons this is not the case. These are polygons that have islands in as
you see in this link:  
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Creating_new_donut_holes_and_island_polygons/001t0000003p000000/
<http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Creating_new_donut_holes_and_island_polygons/001t0000003p000000/>   
I get these wrong results for them as the number of Interior rings:  FID = 7
-> 1FID = 8 -> 2  meaning that islands are not known niether as interior nor
exterior polygons!!!  Can you tell me how can I support islands with
GDAL/OGR library or introduce me another open source that does this?



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/How-can-I-support-polygons-with-islands-in-my-APPLICATION-USING-gdal-ogr-library-tp5077579.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130912/66bb5ac4/attachment.html>


More information about the gdal-dev mailing list