[gdal-dev] GetGeomType() for a MapInfo TAB using OGR MapInfo File driver

Max Demars burton449geo at gmail.com
Thu Apr 24 10:47:36 PDT 2014


Hi!

I am using the OGR MapInfo File driver to read a MapInfo TAB file. However,
the function GetGeomType()<http://gdal.org/python/osgeo.ogr.Layer-class.html#GetGeomType>returns
0 which means point
geometry, even if the features in the TAB are only multi-polygons.

Is it because MapInfo TAB can store many different GeomTypes in the same
file?

If I take for granted that only one geometry type would always be founded
in the TAB, how could I retrieve it?

        driver = ogr.GetDriverByName("MapInfo File")
        datasource = driver.Open(os.path.join(dirname,shapefileName))
        layer = datasource.GetLayer(0)
        geometryType = layer.GetGeomType()

        >>>geometryType
        >>>0


Even when looping over features in layer and retrieving geometry type using
GetDefnRef()<http://gdal.org/python/osgeo.ogr.Feature-class.html#GetGeometryRef>.GetGeomType()
the result is always 0 even for multi-polygon features.

Is there a way to retrieve the geometry type inside a MapInfo TAB ?

Thanks for your help,

-Max Demars
-- 
Stack Overflow: http://stackoverflow.com/users/1914034/burton449
GIS Overflow: http://gis.stackexchange.com/users/14426/burton449
LastFm: http://www.lastfm.fr/user/burton449
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140424/c274ec97/attachment.html>


More information about the gdal-dev mailing list