[postgis-devel] LWgeom and PostGIS Java classes
strk at refractions.net
strk at refractions.net
Mon Dec 13 09:27:53 PST 2004
On Mon, Dec 13, 2004 at 03:55:45PM +0100, Markus Schaber wrote:
> Hello,
>
> I was unable to follow the PostGIS development discussed on this list
> between 0.8.2 and last week.
>
> But as far as I heard, PostGIS 1.0 will be based on lwgeom, and those
> have a new canonical representation that is an extended WKB, the text
> form is encoded in hex.
>
> This means that the Java PostGIS classes have to be changed. As far as
> my time permits, I would help in getting this work (perhaps based on the
> wkb4j code).
>
> Are there any pointers to documentation about this, or do I have to scan
> the list archives?
Markus,
there is no documentation available, but basically:
- Text form is hexized extended WKB + SRID
- Binary form is bytea extended WKB
You should always use asBinary,asText to ensure compatibility
with future releases. In this specific release (1.0) using
a BINARY cursor on a plain geometry field will give you bytea
extended WKB (as for 'send' specification of geometry type).
extended WKB is WKB with ZM flags addition.
These are additional bits in the uint32 WKB type:
#define WKBZOFFSET 0x80000000
#define WKBMOFFSET 0x40000000
If all the bits are off you have plain OGC WKB.
If only one bit is on you have 3d points wherever OGC specifies
2d ones. Semantic of the additional coordinate is given by
the bit position (Z or M).
If both bits are on you have XYMZ (4 doubles) instead of XY.
The canonical text form is same structure converted to HEX
and with an *optional* 'SRID=%d;' prefix:
# POINT(0 0) with SRID=-1
010100000000000000000000000000000000000000
# POINT(0 0 0) with SRID=-1
0101000080000000000000000000000000000000000000000000000000
^ WKBZOFFSET
# POINTM(0 0 0) with SRID=-1
0101000040000000000000000000000000000000000000000000000000
^ WKBMOFFSET
# POINT(0 0 0 0) with SRID=-1
01010000C00000000000000000000000000000000000000000000000000000000000000000
^ WKBMOFFSET|WKBZOFFSET
# POINT(0 0) with SRID=1
SRID=1;010100000000000000000000000000000000000000
>
> Thanks,
> Markus
Thank you, good luck!
--strk;
More information about the postgis-devel
mailing list