Boost logo

Geometry :

Subject: [ggl] [Ticket #2] Implementation of io/wkb module
From: Mateusz Loskot (mateusz)
Date: 2009-06-14 08:35:23

Barend Gehrels wrote:
>> Reading and parsing of linestring WKB added.
> This goes quite fast now :-) Cool. I'll have a look today or tomorrow
> (am finishing some other things) to this and the endians.

OK, no rush.

> One questions already: is an EMPTY point supported? :-) Is it supported
> by OGC?

This is a good question.
For point there is no such thing as empty point in WKB.

Point geometry, a building block of all other geometries, it's defined
as follows:

double x;
double y;

byte byteOrder;
uint32 wkbType; // 1
Point point;

The size of point geometry in bytes is fixed: 1 + 4 + 8 + 8.

For instance, binary form (in hex) of "POINT (1.234 5.678)", visually
decomposed, is given as:


So, there is no way to represent EMPTY point with "no coordinates
included", because bytes of coordinates must always be present.

In PostGIS, empty point/linestring/polygon/... in WKB form is
represented as empty collection

test=# SELECT ST_GeometryFromText('POINT EMPTY')::text;

what represents how the collection is defined:

byte byte_order;
uint32 wkbType; // 7
uint32 num_wkbGeometries;
WKBGeometry wkbGeometries[num_wkbGeometries]

with size in bytes: 1 + 4 + 4 + 0

00000000 // <--- no geometries, stream terminator

PostGIS approach seems to be reasonable.

> p.s. NOTE: today I will commit changes, but I've many made (for
> concept:: etc), so please do not touch too much from the common sources
> today... (WKB/endian of course is untouched by me )



Mateusz Loskot,
Charter Member of OSGeo,

Geometry list run by mateusz at