[gdal-dev] bug in OGRGeometryTypeToName

Ben Discoe ben at vterrain.org
Sun Dec 30 22:06:03 PST 2012


Unless there's something I'm not understanding, it seems there is a highly
visible bug in OGRGeometryTypeToName() in GDAL 1.9.2.  Namely, it says that
all 3D types are 2D, and 2D types are 3D.  See ogrgeometry.cpp:

    bool b25D = wkbFlatten(eType) != eType;
    switch( wkbFlatten(eType) )
    {
      case wkbUnknown:
        if( b25D )
            return "Unknown (any)";
        else
            return "3D Unknown (any)";

See how it returns "3D" in the non-b25D case.

This can be easily demonstrated with ogrinfo on a 2D file (in this case
wkbLineString):

ogrinfo Contour.shp
INFO: Open of ` Contour.shp'
      using driver `ESRI Shapefile' successful.
1: Contour (3D Line String)

Maybe this bug is already fixed in HEAD?

Thanks,
Ben




More information about the gdal-dev mailing list