[Gdal-dev] OGR, SHP, and multi-polygons

Ben Discoe ben at vterrain.org
Thu Feb 5 06:56:04 EST 2004


I've got code which is using Shapelib to read SHP files.  It is not handling
some polygons correctly, so i am trying to change to using OGR instead, in
the hopes that will solve the issue.

The issue is that some SHP files, including some that are example files that
ship  with ESRI software, like 'CNTRY92.SHP', are of type 'Polygon' but
actually contain MultiPolygons.  E.g. the USA is represented as a single
polygon (!) including Alaska and Hawai'i.

When i use Shapelib, it gives me a number of 'parts' (nParts) per polygon.
The information apparently lacking is which 'part' is the exterior, and
which which 'parts' are wholes.

Switching to OGR, the problem remains.  There is only one ExternalRing,
which is _definitely_ not right; in the above example data, if we use only
the ExternalRing, then we get a small island off the coast of Alaska, and
the rest of USA is not loaded.

I'm left wondering - is there any way to successfully load SHP files like
this with either Shapelib or OGR?

Thanks,
Ben




More information about the Gdal-dev mailing list