Skip to content
This repository

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

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

3 participants

Artem Pavlenko Dane Springmeyer Nikolai Lebedev
Artem Pavlenko
Owner

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

Artem Pavlenko
Owner

[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;
Nikolai Lebedev

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.

Dane Springmeyer
Owner

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.

Dane Springmeyer springmeyer referenced this issue from a commit April 09, 2014
Dane Springmeyer add support for rendering (vs skipping) 3D and 4D postgis geometries …
…like POINTZM, LINESTRINGZM, and POLYGONZM - closes #44
83c0db3
Dane Springmeyer springmeyer referenced this issue from a commit April 09, 2014
Dane Springmeyer add #44 to changelog fef45cb
Dane Springmeyer springmeyer closed this April 09, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.