I'm wondering is there a way to visualize 3d data with mapserver? 3D .shp files are in postgis database, and I already connected mapserver to database, but with simple layer in mapfile.

  • For me, MapServer is a webmapping server and it's not possible to visualize 3d data with it. With ArcGis Explorer, yes !!
    – user3120
    Commented Jun 12, 2011 at 23:16
  • What kind of data are you trying to visualize, and how do you want to include the third dimension? the answer is probably not, but there may be workarounds depending on what you're trying to do.
    – scw
    Commented Jun 13, 2011 at 5:38
  • I just want to visualize my hypsometric map with 3d lines over it. Something like GRASS nviz function. Commented Jun 15, 2011 at 10:36

3 Answers 3


MapServer isn't going to do anything for you. You'd have to upgrade to the latest version to even have a chance, as prior versions just stripped the 3rd dimension in the database query. Your best bet might be to try GeoServer and the KML support there and see if you can visualize in Google Earth. Or failing that, write a little PHP script to pull your data out of PostGIS with the ST_AsKML() function and wrap some styling on it on the way through. No magic available though!


One way to go might be to let PostGIS do the 3D projection. I did some simple tests a few months ago to visualize the coming 3D distance functions like ST_3DShortestLine.

What I did was just to use ST_RotateX, ST_RotateY and ST_RotateZ to make the 3D geometry "show more than the topside to the camera".

More elegant and efficient would be to do all the transformations with ST_Affine.

With advanced use of that function I guess it would be possible to get the perspective 3D view too.

The problem as far as I have tried this is that it is just rotating everything around origo. But also that should be possible to workaround.

In this way you ought to make MapServer present your data visually like 3D but MapServer only sees a flat 2D geometry.

If someone succeeds with this I am interested. I have thought about making a fake 3D functionality this way in postgisonline.org. But I don't have knowledge and time to figure out how the transformations should be done with ST_Affine to both give a perspectiv view and to rotate around the center of the mapextent instead of rotating around origo.



You could render your hypsometric map as a Hillshade and then overlay the 3D lines so that you only see the 2D data. If you want to go further you might be able to use 3D rendering software to project shadows from the 3D lines onto the hypsometric map, which should help give the illusion of height to your lines. But Mapserver itself is not going to truly show things in 3D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.