[Gdal-dev] Changes between 1.1.9 and 1.20

Frank Warmerdam warmerdam at pobox.com
Mon May 10 10:51:56 EDT 2004


Clay, Bruce wrote:
> Frank:
> When I used version 1.1.9 in my app I could read ArcView shape files
> from the EP200 data set at http://www.cdc.gov/epiinfo/shape.htm.
> 
> When multiple polygons were used for a given country they were still
> reported as type Polygon and everything was happy.  With the update to
> version 1.2.0 the same data set reports them as multi-polygons and for
> some reason they down parse out the same.  The code I used to use is:
...
> I notice that OGR_G_GetPointCount returns 0 with the multipolygon so I
> tried changing GetPointCount to (OGRMultiPolygon
> *)ring_handl)->getNumGeometries().  That only returns a count of 1.
> That is the only get count type of call I saw when I searched for
> MultiPolygon.

Bruce,

If a geometry is a multipolygon, you should use OGR_G_GetGeometryCount() to
get the number of polygons, and and OGR_G_GetGeometryRef() to get each
polygon.  Then use OGR_G_GetGeometryCount() and OGR_G_GetGeometryRef() on
each polygon to extract the rings which you can then process normally.

Use OGR_G_GetGeometryType() to determine if the geometry is a wkbPolygon or
a wkbMultiPolygon (or wkbPolygon25D/wkbMultiPolygon25D).

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