Introduction to MapServer

MapServer is a real-time map publishing system based on the fat server/thin client mode, when the client sends a data request, the server processes the spatial data in real time and sends the generated data to the client.

The core part of MapServer is the map manipulation module written in C language, many of its functions depend on some open source or free libraries. With GEOS, OGR/GDAL support for multiple vector and raster data, projection transformation is performed in real time through the Proj.4 shared library.MapServer follows the OGC series of specifications, can integrate PostGIS and open source database PostgreSQL, and store and SQL query operations on geospatial data, which supports a series transmission and expression of client-side JavaScript APIs such as ka-map, MapLab, Cartoweb and Chameleon to support geospatial data, and comply with a series of specifications such as WMS, WFS, WCS, WMC, SLD, GML and Filter Encoding developed by OGC.

The history of MapServer

MapServer is an open source geospatial data rendering engine written in C, which originated in the mid-1990s at the University of Minnesota (UMN), NASA, and the Minnesota Department of Natural Resources (MNDNR). A collaborative project - ForNet, and later TerrSIP projects.The government's support played a big role in the development of MapServer in the early stage. This is an open source software released under the MIT-style license for publishing spatial data and interactive map applications on the Web, supporting all major operating systems, including Windows, Linux, Mac OS X, etc.It is not positioned to implement a full-featured GIS, but to provide most of the core GIS functionality for web applications.

In 1994, Steve Lime, the father of MapServer, and his MapServer were familiar to more people. MapServer is not isolated in its growth and development, but is supported by many open source communities and open source enthusiasts. In November 2005, the MapServer Foundation was established with the foundation of "Promoting a professional open source network mapping development environment and community. Even if it was originally focused on network mapping projects, it hopes to provide funding for other open source geographic information projects. It not only promotes the professional development of MapServer, but also promotes the development of the entire open source network mapping technology. With the further development of open source GIS software and the further optimization of the open source network mapping environment, the MapServer Foundation was officially renamed the Open Source Geospatial Foundation (OSGeo) in February 2006, and Autodesk added MapGuide as an open source to the fund. Will further promote the development of MapServer.


MapServer is a popular open source project for presenting dynamic spatial maps on the web. It has the following characteristics:

  • Support for displaying and querying hundreds of raster, vector and database formats
  • Ability to run on a variety of different systems (Windows, Linux, Mac OS X, etc.)
  • Support for popular scripting languages and development environments (PHP, Python, Perl, Ruby, Java, .NET)
  • On-the-fly projection
  • High quality drawing model
  • Fully customizable application output
  • Many off-the-shelf open source application environments

In its most basic form, MapServer is an inactive CGI program that stays on the web server. When a request is sent to MapServer, it will use the information passed in the requested URL and the Mapfile to create an image of the requested map. The request can return the legend, the ruler, the reference map, and the value of the variable passed by the CGI.

Components of MapServer

A simple MapServer contains the following sections, as shown:

![MapServer principle] (./mapserver_general.png)


Structured text configuration file for MapServer applications. It defines the field of the map, which is used to tell the MapServer where and where the data is output. It also defines the map layer. Includes their data sources, projections and symbols, which must have a .map extension, otherwise MapServer will not recognize it. MapFile files organize various map elements into object systems with hierarchical relationships. Data sources, data formats used, user interaction and support for the OGC protocol are also defined in MapFile. The objects included in MapFile and their hierarchical relationships:

Geographic Data

MapServer can utilize multiple types of geographic information data sources. The default is the ESRI data format, which is also supported by other formats.


is the interface between the user and MapServer, which are usually located in the web root directory. In its simplest form, MapServer can be called to place a static map image onto an HTML page. In order for the map to interact, the image is placed on an HTML form of the page.

MapServer CGI

Binary executable. You can receive the request to return images, data, and so on. It is located in the cgi-bin or scripts directory of the web server. Users of the WEB server must have execute permissions on these directories. For security reasons, they cannot be under the root of the web. By default, this program is called mapserv.


Provide an HTML page when the user's browser hits. You need a working web (HTTP) server. For example, Apache or Microsoft's IIS, they are on the same machine as the MapServer you installed.

Comparison of MapServer and GeoServer

Both MapServer and GeoServer are widely used open source WebGIS tools and are often compared for comparison.

  • Functionally: MapServer is weaker than GeoServer, QGIS is stronger than UDIG.
  • Efficiency: Mapserver supports WMS (Web Map service) which is more efficiently, while Geoserver is better at combining attribute queries with WFS (Web Feature service) specifications.

In addition to functional comparisons, it is important to note that when making technology choices during development, MapServer focuses on map services and can be used as a component of a project (even a core component), but other functions need to be implemented by developers most of the time; GeoServer is a relatively complete package that can be used as a product after deployment.

MapServer Features

Provides two ways to work, CGI (for CGI, AJAX, FLEX developers) and MapScript (for Php, Java, C#, Python developers). It is the most efficient in the native CGI mode, and with TileCache, it can quickly generate a large range of map tile data. Comparing .Net and J2EE-based commercial or open source platforms, MapServer is more suitable for high-load large-scale Internet map applications. MapServer is a map service software based on C, which is faster than GeoServer written in JAVA. And MapServer history is much older than GeoServer, and even MapServer's performance is comparable to that of commercial ArcIMS.

Features of GeoServer

GeoServer ( is a J2EE compliant specification that implements WCS, WMS, and WFS specifications and supports TransactionWFS (WFS-T). Its core technology is the integration of the prestigious JavaGISolkit-GeoTools. For spatial information storage, it supports ESRI Shapefile and space databases such as PostGIS, Oracle, ArcSDE, etc. The output GML file meets the requirements of GML2.1.Because it is pure Java, it is more suitable for complex environment requirements, and because of its open source, development organizations can flexibly implement specific target requirements based on GeoServer, which are lack of commercial GIS components.As a pure Java implementation, GeoServer is deployed in the application server, such as Tomcat; its WMS and WFS components respond to requests from browsers or uDigs, accessing configured spatial databases such as PostGIS, OracleSpatial, etc. Maps and GML documents are transferred to the client.

GeoServer has the following advantages:

  1. Supported in the Java language, the standard J2EE framework, the servlet-based and STRUTS frameworks, and support for efficient Spring framework development;
  2. Compatible with WMS and WFS features and support WFS-T specification;
  3. Efficient database support PostGIS, ShapeFile, ArcSDE, Oracle, MySQL, etc.;
  4. Support hundreds of projections;
  5. Ability to output web maps as jpeg, gif, png, etc.