See [https://lists.berlios.de/pipermail/mapnik-users/2007-October/000439.html thread on Mapnik users mailing list].
The PostGIS plugin/WKB reader assumes that geometries are in 2D. Though not standard OGC, PostGIS supports 3D/4D. There are two ways to fix this in Mapnik :
1. Add support for 3D/4D Geometries in wkb reader
2. Use force_2D inside postgis plug-in
[artem] The third way is to use 'force_2D' in SQL :
(select name, type, force_2D(the_geom) as the_geom from roads) as roads_2d;
FYI ST_AsBinary(), which is called by Mapnik, doesn't drop M dimension. I suppose it doesn't drop Z too, but haven't yet tried on 3D data.
I've tested this:
select st_astext(st_geomfromwkb(st_asbinary(geom))) from m_geom;
for MULTILINESTRING M geometry in geom and the result was MULTILINESTRING M type, so it reconstructs wkt from wkb with the proper number of dimensions.
This leads to mapnik not rendering geometries with M dimension, and the only workaround yet is do a preliminary ST_Force_2D in a db.
assigning to 2.3.x milestone - need to at least throw an error or handle more gracefully so this is not a totally silent problem.
add support for rendering (vs skipping) 3D and 4D postgis geometries …
…like POINTZM, LINESTRINGZM, and POLYGONZM - closes #44
add #44 to changelog