<div dir="ltr">Hi!<br><div>
<p>I am using the OGR MapInfo File driver to read a MapInfo TAB file. However, the function <a href="http://gdal.org/python/osgeo.ogr.Layer-class.html#GetGeomType" rel="nofollow" target="_blank">GetGeomType()</a> returns 0 which means <code>point geometry</code>, even if the features in the TAB are only multi-polygons.</p>
<p>Is it because MapInfo TAB can store many different GeomTypes in the same file?</p>
<p>If I take for granted that only one geometry type would always be founded in the TAB, how could I retrieve it?</p>
<pre><code><span> driver </span><span>=</span><span> ogr</span><span>.</span><span>GetDriverByName</span><span>(</span><span>"MapInfo File"</span><span>)</span><span>
datasource </span><span>=</span><span> driver</span><span>.</span><span>Open</span><span>(</span><span>os</span><span>.</span><span>path</span><span>.</span><span>join</span><span>(</span><span>dirname</span><span>,</span><span>shapefileName</span><span>))</span><span>
layer </span><span>=</span><span> datasource</span><span>.</span><span>GetLayer</span><span>(</span><span>0</span><span>)</span><span>
geometryType </span><span>=</span><span> layer</span><span>.</span><span>GetGeomType</span><span>()</span><span>
</span><span>>>></span><span>geometryType
</span><span>>>></span><span>0</span></code></pre>
</div><br clear="all"><div>Even when looping over features in layer and retrieving geometry type using <a href="http://gdal.org/python/osgeo.ogr.Feature-class.html#GetGeometryRef" target="_blank">GetDefnRef()</a>.GetGeomType() the result is always 0 even for multi-polygon features.<br>
<br></div><div>Is there a way to retrieve the geometry type inside a MapInfo TAB ?<br></div><div><br>Thanks for your help,<p>-Max Demars<span class=""><font color="#888888"><br></font></span></p></div>-- <br><div dir="ltr">
<div><div><div>Stack Overflow: <a href="http://stackoverflow.com/users/1914034/burton449" target="_blank">http://stackoverflow.com/users/1914034/burton449</a><br></div></div>GIS Overflow: <a href="http://gis.stackexchange.com/users/14426/burton449" target="_blank">http://gis.stackexchange.com/users/14426/burton449</a><br>
</div>LastFm: <a href="http://www.lastfm.fr/user/burton449" target="_blank">http://www.lastfm.fr/user/burton449</a><br></div>
</div>