5.
Include
Up one level
When this directive is encountered parsing switches to the included file immediately. As a result the included file can be comprised of any valid mapfile syntax. For example:
INCLUDE 'myLayer.map'
Performance does not seem to be seriously impacted with limited use, however in high performance instances you may want to use includes in a pre-processing step to build a production mapfile. The C pre-processor can also be used (albeit with a differnt syntax) and is far more powerful.
Notes
Supported in versions 4.10 and higher.
The name of the file to be included MUST be quoted (single or double quotes).
Includes may be nested, up to 5 deep.
File location can be given as a full path to the file, or (in MapServer >= 4.10.1) as a path relative to the mapfile.
Debugging can be problematic since: 1) the file an error occurs in does not get output to the user and 2) the line number counter is not reset for each file. Here is one possible error that is thrown when the include file cannot be found:
msyylex(): Unable to access file. Error opening included file "parks_include.map"
Example
MAP NAME 'include' EXTENT 0 0 500 500 SIZE 250 250 INCLUDE "test_include_symbols.map" INCLUDE "test_include_layer.map" END
where test_include_symbols.map contains:
SYMBOL NAME 'square' TYPE VECTOR FILLED TRUE POINTS 0 0 0 1 1 1 1 0 0 0 END END
and test_include_layer.map contains:
LAYER
TYPE POINT
STATUS DEFAULT
FEATURE
POINTS 10 10 40 20 300 300 400 10 10 400 END
END
CLASS
NAME 'Church'
COLOR 0 0 0
SYMBOL 'square'
SIZE 7
STYLE
SYMBOL "square"
SIZE 5
COLOR 255 255 255
END
STYLE
SYMBOL "square"
SIZE 3
COLOR 0 0 255
END
END
END
include on ubuntu/debian
Steve
INCLUDE on Windows
My MAP file is under "f:/ms4w/apps/prjname" and the file to include in "f:/ms4w/apps/prjname/common".
For example, I tried:
INCLUDE "/prjname/common/file.ext"
INCLUDE "./common/file.ext"
INCLUDE "/apps/prjname/common/file.ext"
And many more... And always error: "Premature end of script headers"
Help!!!!!
Full Path
(File location must be given as a full path to the file. Relative path definition is coming.)
'INCLUDE' from PHP/Mapscript
In this moment I'm using this: $map->save('mapFileTemp.map'), this create a only one mapfile and I want to create multiple mapfiles included in an one mapfile.
Help me!!! Thank
P.D: I'm using PHP version 5.2.0 (MS4W 2.2), MapServer 4.10.0
include on ubuntu/debian