About us
MapServer is a popular Open Source project whose purpose is to display dynamic spatial maps over the InternetFeatures
Some of its major features include:- support for display and querying of hundreds of raster, vector, and database formats
- ability to run on various operating systems (Windows, Linux, Mac OS X, etc.)
- support for popular scripting languages and development environments (PHP, Python, Perl, Ruby, Java, .NET)
- on-the-fly projections
- high quality rendering
- fully customizable application output
- many ready-to-use Open Source application environments
- In its most basic form, MapServer is a CGI program that sits inactive on your Web server. When a request is sent to MapServer, it uses information passed in the request URL and the Mapfile to create an image of the requested map. The request may also return images for legends, scale bars, reference maps, and values passed as CGI variables.
- MapServer can be extended and customized through MapScript or templating. It can be built to support many different vector and raster input data formats, and it can generate a multitude of output formats. Most pre-compiled MapServer distributions contain most all of its features.
Architecture
A simple MapServer application consists of:
- Map File - a structured text configuration file for your MapServer application. It defines the area of your map, tells the MapServer program where your data is and where to output images. It also defines your map layers, including their data source, projections, and symbology. It must have a .map extension or MapServer will not recognize it.
- Geographic Data - MapServer can utilize many geographic data source types. The default format is the ESRI shapefile. Many other data formats can be supported, this is discussed further below in Adding data to your site.
- HTML Pages - the interface between the user and MapServer . They normally sit in Web root. In it’s simplest form, MapServer can be called to place a static map image on a html page. To make the map interactive, the image is placed in an html form on a page.
- MapServer CGI - The binary or executable file that receives requests and returns images, data, etc. It sits in the cgi-bin or scripts directory of the http server. The Web server user must have execute rights for the directory that it sits in, and for security reasons, it should not be in the web root. By default, this program is called mapserv
- HTTP Server - serves up the html pages when hit by the user’s browser. You need a working HTTP (Web) server, such as Apache or Microsoft Internet Information Server, on the machine on which you are installing MapServer.
A simple MapServer CGI application may include two html pages:
- Initialization File - uses a form with hidden variables to send an initial query to the http server and MapServer. This form could be placed on another page or be replaced by passing the initialization information as variables in a URL.
- Template File - controls how the maps and legends output by MapServer will appear in the browser. By referencing MapServer CGI variables in the template html, you allow MapServer to populate them with values related to the current state of your application (e.g. map image name, reference image name, map extent, etc.) as it creates the html page for the browser to read. The template also determines how the user can interact with the MapServer application (browse, zoom, pan, query).
Common Gateway Interface (CGI)
- The Common Gateway Interface (CGI) is a standard that defines how web server software can delegate the generation of web pages to a stand-alone application, an executable file. Such applications are known as CGI scripts; they can be written in any programming language, although scripting languages are often used.
- The common gateway interface (CGI) is a standard way for a Web server to pass a Web user's request to an application program and to receive data back to forward to the user. When the user requests a Web page (for example, by clicking on a hyperlink or entering a Web site address), the server sends back the requested page. However, when a user fills out a form on a Web page and sends it in, it usually needs to be processed by an application program. The Web server typically passes the form information to a small application program that processes the data and may send back a confirmation message. This method or convention for passing data back and forth between the server and the application is called the common gateway interface (CGI).
Installation and Requirements
Windows Installation
OSGeo4W is a new Windows installer that downloads and/or updates MapServer, add-on applications, and also other Open Source geospatial software. The following steps illustrate how to use OSGeo4W:- Download OSGeo4W
http://download.osgeo.org/osgeo4w/osgeo4w-setup.exe
- Execute (double-click) the .exe
- Choose “Advanced” install type
Note
Express contains options for higher-level packages such as MapServer, GRASS, and uDig. Advanced gives you full access to choosing commandline tools and applications for MapServer that are not included in the Express install
- Select packages to install
Note
Click on the “Default” text beside the higher-level packages (such as Web) to install all of Web’s sub-packages, or click on the “Skip” text beside the sub-package (such as MapServer) to install that package and all of its dependencies.
- Let the installer fetch the packages.
- Run the apache-install.bat script to install the Apache Service.
Note-You must run this script under the “OSGeo4W Shell”. This is usually available as a shortcut on your desktopNote-A apache-uninstall.bat script is also available to remove the Apache service installation. - Start Apache from the OSGeo4W shell and navigate to http://127.0.0.1
apache-restart.bat
- Verify that MapServer is working
