[postgis-devel] Canonical binary form AND WKB

strk at refractions.net strk at refractions.net
Fri Dec 17 03:19:40 PST 2004


Changed subject and started new thread to reflect discussion.

A 'canonical binary' representation has been defined for
LWGEOM, being the exact internal representation with an
additional inizial byte specifying byte order:

	0 : XDR : big endian
	1 : NDR : little endian

These are available with a cast to/from bytea, and are fast
and lossless conversions.
Bytes flipping is unsupported in both forward and backward
conversions.

WKB is another binary representation, again encoded as a bytea
but different from the canonical binary representation in that
it does not contain a SRID. WKB can be produced and accepted
in both XDR and NDR form. It's implementation is currently slow.
It understands an 'extended' OGC WKB including 3dz, 3dm and 4d
geometries.

One question is wheter make output of asBinary() *always* OGC
compliant. This can be done internally forcing the geometries
to 2d form.

Another question is how to distinguish between an OGC WKB
(extended or not) and a canonical form, which are currently
both of type bytea. 

Comments welcome.

--strk;



More information about the postgis-devel mailing list