[postgis-devel] ST_AsBinary(geometry) 2.0

Paul Ramsey pramsey at opengeo.org
Mon Dec 6 09:54:46 PST 2010


This is a more controversial discussion than the text one, because
there are known in-the-wild systems that interchange with PostGIS
using AsBinary. Probably most of the systems that originally used
AsText have in fact long since swapped over to AsBinary.

So, as with AsText, the current behavior of AsBinary is to strip out
the higher dimensions.  This renders the OGC and ISO forms identical.

When higher dimensions are allowed in, the forms diverge.

The flagging of the dimensionality is different. The current AsEWKB
emitter uses the "extended" flags on the top of the 32-bit type number
to indicate dimensional differences. The ISO form is to add multiples
of 1000 to the type number to indicate Z (1000), M (2000), and ZM
(3000) variants.

If we change what AsBinary emits, then all client programs that use it
will have to either (a) add a Force2d() to their SQL to ensure the
outputs remain as they expect or (b) add some extra WKB handling to
deal with higher dimensionality.

I think AsEWKB should continue to emit the extended well-known binary
as currently understood.

Discussion?

P.



More information about the postgis-devel mailing list