2. Cartographic Application of MapServer#
This part focuses on the techniques of cartography in MapServer. Including the use of layers and style settings, text annotations.
MapServer configures the map to publish through a map file (Mapfile). Mapfile is the core of using MapServer. It organizes various map elements into a hierarchical object system, declaring the size and format of the generated map, all the paths, names and formats of the data used, as well as a variety of more complex control options. The syntax for configuring Mapfile files is simple and easy to learn, especially if you have experience of using desktop GIS software such as ArcMap to make thematic maps. Mapfile is multi-layered, and each map file defines a large number of other objects. These objects include scale bars, legends, map colors, map names, map layers, and so on.
Configuring a complete Mapfile file requires GIS data sources, font files, and symbol files. GIS data sources can be distributed on different computers; font files are used to define the font types used in the output map. The point, line and surface symbols used in the map can be defined in the Symbol object of the Mapfile file; however, in order to achieve symbol reuse, independent symbol files are usually defined outside the Mapfile, and there is no need to define the same symbols in different Mapfile files.
After planning the WebGIS website, configure the Mapfile file steps:
Prepare the resources required for Mapfile files, including GIS data, font files, and symbol files.
According to the requirements of WebGIS website, follow the syntax of Mapfile, use text editing software or special Mapfile writing software such as MapLab to write Mapfile.
Use debugging software (such as MapLab) to test and see if the Mapfile configuration is correct and appropriate.
The core program of MapServer is used to generate maps according to geospatial data, configure the function of using CGI, and give it the function of WebGIS. MapServer supports distribution and interoperability by supporting several standards from the OGC Consortium. Whether using the MapServer CGI module or the server-side scripting language MapScript, the dynamic interaction between the server and the client browser can be realized.
- 2.1. Add a grid layer
- 2.2. Add a graticule
- 2.3. Change the output format of the map
- 2.4. Publish a vector layer
- 2.5. Static map with two layers
- 2.6. Build a map with multiple layers
- 2.7. Display layers by attribute category
- 2.8. Annotations in a map
- 2.9. Use custom styles in Mapfile
- 2.10. Define projection and extent
- 2.11. Add a scale bar
- 2.12. Add Legend