MapServer Tuning

Projection Information

The standard MapServer install will have a library of projection information. From Version 5.6.2 Astun provide a cut-down projections file which may be used as customers are generally only interested in a few projections and this is quicker than reading in an entire projection library.

To point your .map file to the custom iShare projections by changing the CONFIG "PROJ LIB" entry to the following:

Replace this
CONFIG "PROJ_LIB" "projections"

If you wish to add your own alternate projections please see the topic Configuring Projections for details.

Logging

If your MapServer map file is in on a production server it will have passed all testing so there’s no reason to keep debugging to a high level. Set DEBUG 0. Remove all mentions of DEBUG in individual layers.

Symbol Sets

Same procedure as projections here. Remove all SYMBOL definitions that are not used by your layers. Either define the symbols in the map file or reference an edited SYMBOLSET file. See the topic Configure MapServer Cartography for details.

Font Sets

Same procedure again. Identify which fonts are being used by your map file and remove unnecessary FONT definitions in the fonts.list. If you are not using any fonts then remove the FONTSET line.

Shape Path

This is often a standard parameter in the MapServer map file but if you are not using any shape files [.shp] then it can be removed.

PostgreSQL data

Use an INCLUDE for the PostgreSQL CONNECTION details. By using the following setup MapServer will attempt to use the same connection for all the PostgreSQL LAYERs.

INCLUDE Example
LAYER
   NAME councils
   INCLUDE "datashare.inc"
   ...
END

 

Now you need to create a .txt file with the name "datashare.inc", or whatever you have called it in your INCLUDE statement, with the following information. This file needs to reside in the same folder as the .map file unless you have added a path in the INCLUDE statement.

CONNECTION “user=me password=nottelling dbname=isharedata host=127.0.0.1”
CONNECTIONTYPE POSTGIS
PROCESSING “CLOSE_CONNECTION=DEFER”

On some setups there is a delay in resolving to "localhost" so if the IP address is known use it. In this case we’re using the local instance of PostgreSQL.