[Gdal-dev] FeatureDefn.getGeometryType and actual geometry type

Frank Warmerdam warmerdam at pobox.com
Sun Feb 4 13:03:10 EST 2007


Andrea Aime wrote:
> Hi,
> playing with OGR and polygon shapefiles I noticed that
> the getGeometryType returns (wkbPolygon, 3). Yet, reading the
> shapefile also multipolygons may come out.
> This is no news to me, in Geotools we always say a polygon
> shapefile has in fact multi-polygon geometries because
> there is no real difference in the shapefile specification
> between simple and multi polygons (the same happens for
> lines, but not for points afaik).
> 
> What I'd like to know is, should I assume multi-geometries
> may come out of a simple types for other data formats too?
> Or is considered to be a bug (since there is a mismatch between
> the declared type and the returned one)?

Andrea,

It is a known bug that I am very nervous about changing.  If I
were to change the declaration to multipolygon then I would have
to convert all polygon geometries to multipolygons which would no
doubt confuse and confound many users and applications.

I'm more likely to fallback to considering the layers of type Geometry -
ie. no known type of geometry.

In summary, you shouldn't trust the geometry types too much currently.

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    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list