pgrouting and mapserver

The third in an occasional series of posts dabbling in PgRouting Once you’ve got your PgRouting database configured in PostgreSQL (see here and here for more information) you might want to use the routing data in an online map. There are a number of tutorials around for doing this using geoserver, and some information on using mapserver, but also a distressing number of posts pleading for assistance! So, in the spirit of sharing, this is my attempt to pull the various bits of advice together into something a bit more comprehensive.

mapserver openlayers viewer

The Mapserver 6.0 release comes with a really useful feature, which they snuck in really quietly but deserves more praise in my opinion: a built-in openlayers viewer. It’s very simple, and only for testing purposes, but it’s so much easier for debugging your mapserver map file compared to the old “mode=map&layers=all” approach. The syntax for calling it is very similar to the old “mode=map” approach (split into separate lines for clarity here but in reality all one line):

mapserver tilecache and proxies

If you end up doing a lot of work on mapserver and tilecache behind corporate proxy servers, you’re likely to hit a couple of snags, when the proxy thinks you’re trying to do something evil, when really all you want to do is seed a tilecache or look at an external WMS server. Fortunately there are a couple of useful workarounds, which I record here for my own sanity as much as anything else!

upon learning about postgresql arrays and mapserver

I learnt something new this week (week 2 in my new job)- it’s probably not new to everyone else, but just in┬ácase someone is interested I thought I would document it… Scenario: You have some Ordnance Survey Mastermap data in a PostgreSQL database imported using OGR2OGR. You wish to display it using Mapserver. The key fields you are interested in for styling your data are “descriptivegroup”, “descriptiveterm” and “make”. These dictate the actual detail about the styling, such as the type of building or type of land.