[gdal-dev] ISO WKB

Even Rouault even.rouault at mines-paris.org
Fri Dec 13 13:07:43 PST 2013


Le vendredi 13 décembre 2013 21:00:33, Paul Ramsey a écrit :
> I’ve pushed up some work to do this
> 
> https://github.com/pramsey/gdal/tree/isowkb
> 
> I had to change *two* method signatures, which I don’t really like, both
> exportToWkb and getGeometryType needed a variant parameter added. The
> problem is that getGeometryType returns the full WKB type, with
> dimensionality encoded, which makes it somewhat duplicative of
> getCoordinateDimension. In an ideal world, getGeometryType would only
> return the type number, and dimensionally information would be inferred
> from getCoordinateDimension.
> 
> Then only the exportToWkb signature would need a variant parameter.
> 
> importFromWkb also was changed to ingest the ISO variant if that’s what
> it’s fed. No changes to signature required there.

The fact that getGeometryType() returns type + dimensionality is actually not 
new to your proposal.

The main issue I see is that, now, the OGRwkbGeometryType enumeration contains 
different ways of encoding the same information. For mortals, a wkbPoint25D is 
the same as a wkbPointIsoZ. As OGRwkbGeometryType belongs to the OGR public C 
API, we must be careful when touching it. The direct consequence of 
introducing new values is that all code that currently accepts 
OGRwkbGeometryType as an argument will not know what to do with it if it is 
fed with a wkb*****IsoZ value. Such code is for example the implementation of 
the CreateLayer() method of all existing OGR drivers that have creation 
capabilities. The wkbFlatten() macro will not work on IsoZ constants.

Perhaps a documentation note saying that the wkb****IsoZ values are only 
returned by getGeometryType(OGRwkbVariant = wkbVariantIso), and should not be 
used as values of parameters of any method should be sufficient ?

Or have a separate OGRwkbIsoGeometryType enumeration { wkbPointIso, ... 
wkbGeometryCollectionIso, wkbPointIsoZ, ... wkbGeometryCollectionIsoZ }, a 
getIsoGeometryType() method that returns it, and the exportToWkb() methods 
that calls int getGeometryType(OGRwkbVariant eVariant) { return (eVariant == 
wkbVariantOgc) ? getGeometryType()  : getIsoGeometryType(); }

I'm not sure what's the best way of addressing that. It looks like the now 
famous motto "We can't be compatible to MULTIPLE standards at the same time." 
applies...

Even

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list