[postgis-users] WKB4J

Dave Blasby dblasby at refractions.net
Mon Jul 29 10:25:04 PDT 2002


David Garnier wrote:
> > Are you handling 3d points?  PostGIS (and several other WKB-producing
> > Open Source projects) are adding 80x (128 decimal) to the WKB type and
> > then putting in 3 doubles for points (x,y,z).
> 
> Well right now it doesn't, but it would just require one switch case and 3 more methods in the Factory interface. Do you have a reference where I could learn more about this?

There isnt a reference for it, unfortunately.

PostGIS will produce 3D WKB by default if there are 3d points in the
geometric object.

For example,

> SELECT asBinary('POINT(0 1 2)');
> SELECT asBinary('LINESTRING(0 0 0, 1 1 1)');

Note; you can convert a 3d geometry into a 2d geometry by calling the
force_2d() function on it:

> SELECT force_2d('POINT(0 1 2)');
	-> POINT(0 1)
> SELECT force_2d('LINESTRING(0 0 0, 1 1 1)');
	-> LINESTRING(0 0, 1 1)

enum wkbGeometryType {
wkbPoint = 1,
wkbLineString = 2,
wkbPolygon = 3,
wkbMultiPoint = 4,
wkbMultiLineString = 5,
wkbMultiPolygon = 6,
wkbGeometryCollection = 7,

wkbPoint3d = 129,
wkbLineString3d = 130,
wkbPolygon3d = 131,
wkbMultiPoint3d = 132,
wkbMultiLineString3d = 133,
wkbMultiPolygon3d = 134,
wkbGeometryCollection3d = 135
};

Point {
double x;
double y;
};

Point3d {
double x;
double y;
double z;
};




More information about the postgis-users mailing list