[gdal-dev] why the layer changed geometry type after insert into gdb

Even Rouault even.rouault at spatialys.com
Wed Jan 7 02:45:13 PST 2015


Le mercredi 07 janvier 2015 11:35:14, Rebecca a écrit :
> I created a gdb with filegdab api  in gdal, then create an ogrlayer int gdb
> by function CreateLayer(newlayername,spatial,geotype,option),
>  the thrid parameter "geotype"=wkbLinestring, after created the layer,  I
> get the layer geometry type by function layerGeoType=pLayer->getgeomtype();
> but the "layerGeoType"=wkbmultilinestring, is not the same as before I set
> the layer type wkbLinestring.
>   I tried wkblinestring layer, wkbpolygon layer , all the layer into
> gdbfile , their geometry type become wkbmultilinestring, wkbmultipolygon,
> how could I control the layer geometry type in filegdb which would be the
> same as before.

Rebecca,

This is a specfic behaviour of the FileGDB driver due to the FileGDB format 
itself that doesn't recognize the difference between a linestring and a 
multilinestring, or a polygon and a multipolygon, since the stored geometries 
are always "multi".
Thus the choice has been made in the FileGDB driver to expose and convert 
everything as  "multi" geometry type.
When writing you should be able to pass a single linestring/polygon and it 
will be automatically converted. When reading, you will always get the multi 
representation.
So this is intended behaviour. Not much that can be done about that.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list