[gdal-dev] ISO WKB

Even Rouault even.rouault at mines-paris.org
Thu Dec 12 14:57:58 PST 2013


Le jeudi 12 décembre 2013 23:39:25, Paul Ramsey a écrit :
> I’ve been looking over the code, and I think I can make importFromWkb
> consume ISO inputs with relatively minor changes. (during the geometry
> type determination in the concrete types, it looks easy enough to add a
> little logic to deal with ISO type numbers) For exportToWkb, I’m wondering
> if maybe an optional parameter (wkbVariant?) that defaults to
> wkbVariantOGC would be sufficient?

Sounds good to me. Is "wkbVariantOGC" the variant currently implemented ? Is 
our 3D support really compliant with an OGC standard ?

> 
> It also seems the wkb reader/writer have little handling for empty geometry
> types. I’d like to add some in, if that’s OK.

Are you sure about that ?

See :

>>> from osgeo import ogr
>>> ogr.CreateGeometryFromWkb(g.ExportToWkb()).ExportToWkt()
'LINESTRING EMPTY'
>>> ogr.CreateGeometryFromWkb(ogr.CreateGeometryFromWkt('LINESTRING 
EMPTY').ExportToWkb()).ExportToWkt()
'LINESTRING EMPTY'
>>> ogr.CreateGeometryFromWkb(ogr.CreateGeometryFromWkt('LINESTRING 
EMPTY').ExportToWkb()).ExportToWkt()
'LINESTRING EMPTY'
>>> ogr.CreateGeometryFromWkb(ogr.CreateGeometryFromWkt('POLYGON 
EMPTY').ExportToWkb()).ExportToWkt()
'POLYGON EMPTY'
>>> ogr.CreateGeometryFromWkb(ogr.CreateGeometryFromWkt('MULTILINESTRING 
EMPTY').ExportToWkb()).ExportToWkt()
'MULTILINESTRING EMPTY'
>>> ogr.CreateGeometryFromWkb(ogr.CreateGeometryFromWkt('MULTIPOLYGON 
EMPTY').ExportToWkb()).ExportToWkt()
'MULTIPOLYGON EMPTY'
>>> ogr.CreateGeometryFromWkb(ogr.CreateGeometryFromWkt('GEOMETRYCOLLECTION 
EMPTY').ExportToWkb()).ExportToWkt()
'GEOMETRYCOLLECTION EMPTY'

The only exception is POINT EMPTY due to the lack of wkb representation for it 
:
>>> ogr.CreateGeometryFromWkb(ogr.CreateGeometryFromWkt('POINT 
EMPTY').ExportToWkb()).ExportToWkt()
'POINT (0 0)'


> 
> Fortunately the only substantial difference for ISO WKB is the type number.
> 
> I’m starting an isowkb branch on my git repo to hold this piece of work, I
> don’t think it’ll be very big.
> 
> Then I’ll start asking about ‘m’ dimensions :)

That's a fresh new land to explore...

> 
> P.
> 
> -- 
> Paul Ramsey
> http://cleverelephant.ca
> http://postgis.net
> 
> On December 12, 2013 at 2:33:41 PM, Even Rouault
> (even.rouault at mines-paris.org) wrote:
> 
> Le jeudi 12 décembre 2013 21:36:42, Paul Ramsey a écrit :
> > Hey all,
> > Is there already a facility for writing out ISO-standard WKB in GDAL? The
> > biggest difference is the wkbGeometryType number for the case of 3d
> > features. OGR currently uses the old extended SFSQL adopted by PostGIS.
> > ISO (naturally) did their own thing. As far as I can see, there’s no
> > support there now, or is there? P.
> 
> Hi Paul,
> 
> no, there's no support for ISO WKB yet. We still stick to
> http://home.gdal.org/projects/opengis/twohalfdsf.html
> 
> I can imagine we could have exportToISOWkb() method in OGRGeometry*. Or we
> could add an extra boolean argument bISOWkb to the existing exportToWkb().
> Not sure about WkbSize() : does the size of ISO WKB blobs differ from the
> unofficial WKB ?
> 
> Even
> 
> --
> Geospatial professional services
> http://even.rouault.free.fr/services.html

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


More information about the gdal-dev mailing list