Common Pitfalls with Mapserver Documents

©John Porter 2005


General troubleshooting advice:

  1. When altering a map, change only a few things at a time – that way if something breaks you know where to focus your attention.

  2. To help isolate a problem use comment markers (#) to temporarily disable commands you are having problems with to see if their elimination allows the map application to run.


Symptom

Possible Solution

I can’t find my map on the web

  • Your URL should look like:

http://www.vcrlter.virginia.edu/cgi-bin/mapserv?map=/home/evsc468/public_html/2005/mst3k/mymap.map

where you substitute the year for 2005, your userID for mst3k and the name of your mapfile for mymap.map

HTML boxes etc. show up but map is blank

  • Double check that the EXTENT is set correctly and corresponds to the coordinate systems in the shapefiles you are using. Right click on a layer in ARCGIS and select PROPERTIES and then the SOURCE tab to get information on the extent of a shapefile.

  • Also look at the STATUS option for the troublesome layers. DEFAULT means “Always Show”, OFF means “Always Off”. Only the ON option lets you toggle a layer off and on from the web page.

Only some layers appear

  • Look at STATUS above

  • Make sure that polygon layers are towards the TOP of the mapfile – otherwise they may cover up other layers, thus hiding them.

  • Double check to make sure that ALL the shapefiles you are using share the same coordinate system. If not, project them to the same system (there are also options in Mapserver for projecting on-the-fly, but for simple maps, just PROJECTing the shapefiles often works best).

Class names don’t show up correctly in the legend

  • Make sure that class names that include spaces have quotes (“) around them. This also holds for other names with spaces.

I changed the size of my map, now every time I redisplay my map it moves around the screen

  • You need to make sure that your .html template has the correct center coordinates for the image size you are using. Specifically the hidden input for the “imgxy” field should be values that are ½ those in the SIZE settings in the .map file