[Mapserver-dev] WKB geometry in mappostgis.c
Attila Csipa
attila at prometheus.org.yu
Mon Feb 10 08:47:17 EST 2003
I'm looking at the mappostgis.c code and trying to implement WKB geometry for
the mysql module, but there are some interesting things. For one, the WKB as
used is NOT compliant to the WKB spec, as given in the SFSQL RFC. Since
postgis WKB seems to be working the question is if there are multiple
versions of WKB specifications floating around or am I just missing something
?
In the code below it is clearly visible that the type of WKB geoms is stored
for each geometry, and the first is located on byte 10 of the WKB. According
to SFSQL specs, this is not so - the type is defined only once, on byte 2
(except for special WKB types, line is not one of them). This is for
starters, there are other differences, too.
int force_to_lines(char *wkb, shapeObj *shape)
{
int offset =0;
int ngeoms, t ;
int type,nrings,npoints;
shape->type = MS_SHAPE_NULL; //nothing in it
memcpy( &ngeoms, &wkb[5], 4);
offset = 9; //were the first geometry is
for (t=0; t<ngeoms; t++)
{
memcpy( &type, &wkb[offset+1], 4); // type of this geometry
etc, etc...
More information about the mapserver-dev
mailing list