[gdal-dev] mapinfo driver - polygon geometries

Even Rouault even.rouault at mines-paris.org
Tue Mar 18 05:18:27 PDT 2014


Cemal,

I guess the reason might be that regions can be according to cases Polygons (one
outer ring with 0 or more inner rings) or MultiPolygons (several outer rings
with 0 or more inner rings), which are 2 directinct geometry types in OGR model
(following Simple Features specifications). Well, other drivers such as
Shapefile don't do that distinction and advertize Polygon, but this cause
problems when converting to PostGIS or Spatialite for example (that strictly
enforce geometry types).

Even

> Hi,
>
> I want to ask a question for the mapinfo(mitab) driver. When i try to open
> a .tab file whose geometry type is polygon, OGRFeatureDefn::GetGeomType
> method for layer object return wkbUnknown instead of wkbPolygon. When i
> search for the mitab_tabfile.cpp for the geometry type parsing code, i
> encounter with this block of code in the TABFile::Open method .
>
>         int numPoints=0, numRegions=0, numTexts=0, numLines=0;
>
>         GetFeatureCountByType( numPoints, numLines, numRegions, numTexts);
>
>         numPoints += numTexts;
>         if( numPoints > 0 && numLines == 0 && numRegions == 0 )
>             m_poDefn->SetGeomType( wkbPoint );
>         else if( numPoints == 0 && numLines > 0 && numRegions == 0 )
>             m_poDefn->SetGeomType( wkbLineString );
>   else
>             /* we leave it unknown indicating a mixture */;
>
> the case for  the "numPoints == 0 && numLines == 0 && numRegions > 0" is
> missing. So polygon support is missing. When i add this case to code and
> set the geomtype as polygon, the driver works fine for polygon files. Is
> this a bug or is it intentionally missing?
>
> Thanx.
>
> cemal.
>




More information about the gdal-dev mailing list