[Mapserver-dev] WKB geometry in mappostgis.c

David Blasby dblasby at refractions.net
Mon Feb 10 13:11:26 EST 2003

If you read the query portion, you'll see that the query that gets sent to
PostGIS  looks like:

SELECT asbinary(force_collection(force_2d(the_geom)),'NDR'), .... FROM ...


   +  forces the geometry to a 2d representation (mapserver doesn't handle 3d
            the WKB for 3d geometries isn't well defined, and its a waste of
transferring data)
   +  converts the geometry to geometry collection - this makes the WKB parser
       easier - you dont have to have a MULTIPOINT, MULTILINESTRING, or
       MULTIPOLYGON parser.  Just a collection and point, linestring, and polygon
   +  the as_binary converts the PostGIS geometry into WKB.

This means the transfer from postgresql to mapserver is [usually] efficient and
the parser can be very
simple.  The parser also does some type conversion because mapserver requires
homogenous data
types (ie. all points, or all lines), while postgis can be heterogeneous.

ps. there is a WKB parser in postgis_debug.c, but its extremely ugly!

More information about the mapserver-dev mailing list