add support for 3D/4D postgis geometries #44

Closed
artemp opened this Issue Oct 11, 2011 · 3 comments

Projects

None yet

3 participants

@artemp
Mapnik member

See [https://lists.berlios.de/pipermail/mapnik-users/2007-October/000439.html thread on Mapnik users mailing list].

And http://support.mapbox.com/discussions/tilemill/7787-postgis-layer-loads-but-features-are-empty

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

@artemp
Mapnik member

[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;
@nextstopsun

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.

@springmeyer
Mapnik member

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.

@springmeyer springmeyer added a commit that referenced this issue Apr 9, 2014
@springmeyer springmeyer add support for rendering (vs skipping) 3D and 4D postgis geometries …
…like POINTZM, LINESTRINGZM, and POLYGONZM - closes #44
83c0db3
@springmeyer springmeyer added a commit that referenced this issue Apr 9, 2014
@springmeyer springmeyer add #44 to changelog fef45cb
@springmeyer springmeyer closed this Apr 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment