Author: | David Fawcett |
---|---|
Contact: | david.fawcett at gmail.com |
Revision: | $Revision: 8365 $ |
Date: | $Date: 2008-12-31 07:49:02 -0800 (Wed, 31 Dec 2008) $ |
Last Updated: | 2007/08/01 |
Table of Contents
The contents of a Map File are used by MapServer for configuration, data access, projection, and more. Because the Map File is parsed every time a map image is requested, it is important to think about what you include in the file in order to optimize performance. The optimal Map File is one that doesn’t include or reference anything that isn’t needed.
There are two ways to define projections in a Map File. You can either use inline projection parameters or specify an EPSG code for that projection. If you use the EPSG code method, Proj.4 looks up the projection parameters in the Proj4 database using the EPSG code as an ID. This database lookup takes significantly more resources than when the projection parameters are defined inline. This lookup takes place for each projection definition using EPSG codes in a Map File.
Projection defined using inline projection parameters
PROJECTION
"proj=utm"
"ellps=GRS80"
"datum=NAD83"
"zone=15"
"units=m"
"north"
"no_defs"
END
Projection defined using EPSG Code
PROJECTION
"init=epsg:26915"
END
Optimization Suggestions
For every layer in a Map File that has a status of ON or DEFAULT, MapServer will load that layer and prepare it for display, even if that layer never gets displayed.
Optimization Suggestions
CLASS
EXPRESSION ('[NAME]' eq 'WY'])
STYLE
COLOR 255 0 0
END
END
CLASS
STYLE
COLOR 128 128 128
END
END
But it would be a lot more efficient to do this, since 98% of cases will be matched on the first try:
CLASS
EXPRESSION ('[NAME]' ne 'WY'])
STYLE
COLOR 128 128 128
END
END
CLASS
STYLE
COLOR 255 0 0
END
END
When the Map File is loaded, each raster symbol listed in the symbols file is located on the filesystem and loaded.
Optimization Suggestions
To load a font, MapServer opens up the fonts.list FONTSET file which contains an alias for the font and the path for that font file. If you have a fonts.list file with a long list of fonts, it will take more time for MapServer to locate and load the font that you need.
Optimization Suggestions