|Home | Products | Issue Tracker | FAQ | Download|
|Contact:||steve.lime at dnr.state.mn.us|
|Contact:||jmckenna at gatewaygeomatics.com|
|Contact:||jdoyon at ccrs.nrcan.gc.ca|
The Mapfile is the heart of MapServer. It defines the relationships between objects, points MapServer to where data are located and defines how things are to be drawn.
The Mapfile consists of a MAP object, which has to start with the word MAP.
There are some important concepts that you must understand before you can reliably use mapfiles to configure MapServer. First is the concept of a LAYER. A layer is the combination of data plus styling. Data, in the form of attributes plus geometry, are given styling using CLASS and STYLE directives.
An Introduction to MapServer for “An Introduction to the Mapfile”
The Mapfile is NOT case-sensitive.
The Mapfile is read from top to bottom by MapServer; this means that LAYERs near the top of your Mapfile will be drawn before those near the bottom. Therefore users commonly place background imagery and other background layer types near the top of their mapfile, and lines and points near the bottom of their mapfile.
Strings containing non-alphanumeric characters or a MapServer keyword MUST be quoted. It is recommended to put ALL strings in double-quotes.
For MapServer versions < 5, there was a default maximum of 200 layers per mapfile (there is no layer limit with MapServer >= 5). This can be changed by editing the map.h file to change the value of MS_MAXLAYERS to the desired number and recompiling. Here are other important default limits when using a MapServer version < 5:
MapServer versions >= 5 have no limits for classes, styles, symbols, or layers.
Comments are designated with a #.
Attributes are named using the following syntax: [ATTRIBUTENAME].
that the name of the attribute included between the square brackets IS CASE SENSITIVE. Generally ESRI generated shape data sets have their attributes (.dbf column names) all in upper-case for instance, and for PostGIS, ALWAYS use lower-case.