[gdal-dev] ogr.GeometryTypeToName oddness

Even Rouault even.rouault at mines-paris.org
Tue Apr 16 23:07:39 PDT 2013


Le mercredi 17 avril 2013 04:08:02, Mike Toews a écrit :
> With the Python module for GDAL 1.9.2 for Python 2.7, Windows 64-bit,
> downloaded from http://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal I see
> this oddness:
> 
> from osgeo import ogr
> for name in dir(ogr):
>     if name.startswith('wkb'):
>         i = getattr(ogr, name)
>         print('%s : %d : %r' % (name, i, ogr.GeometryTypeToName(i)))
> 
> wkb25Bit : -2147483648 : 'Unknown (any)'
> wkb25DBit : -2147483648 : 'Unknown (any)'
> wkbGeometryCollection : 7 : '3D Geometry Collection'
> wkbGeometryCollection25D : -2147483641 : 'Geometry Collection'
> wkbLineString : 2 : '3D Line String'
> wkbLineString25D : -2147483646 : 'Line String'
> wkbLinearRing : 101 : 'Unrecognised: 101'
> wkbMultiLineString : 5 : '3D Multi Line String'
> wkbMultiLineString25D : -2147483643 : 'Multi Line String'
> wkbMultiPoint : 4 : '3D Multi Point'
> wkbMultiPoint25D : -2147483644 : 'Multi Point'
> wkbMultiPolygon : 6 : '3D Multi Polygon'
> wkbMultiPolygon25D : -2147483642 : 'Multi Polygon'
> wkbNDR : 1 : '3D Point'
> wkbNone : 100 : 'None'
> wkbPoint : 1 : '3D Point'
> wkbPoint25D : -2147483647 : 'Point'
> wkbPolygon : 3 : '3D Polygon'
> wkbPolygon25D : -2147483645 : 'Polygon'
> wkbUnknown : 0 : '3D Unknown (any)'
> wkbXDR : 0 : '3D Unknown (any)'
> 
> A few observations:
> 
>  - The 2D geometries (e.g. wkbLineString) are reported as 3D
> geometries by ogr.GeometryTypeToName(), but this is false.
> Furthermore, other OGR documents refer to these geometries as so
> called 2.5D geometries, and not true 3D geometries.
> 
> - The 2.5D geometries (e.g. wkbLineString25D) are simply reported as
> their geometry type, and no mention of dimensions.
> 
> It seems the "3D " name prepending logic is reversed.

Known issue : see http://trac.osgeo.org/gdal/ticket/4871

> 
> -Mike
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list