Using MapServer (1) – 10 Minute Tutorial

May 19th, 2007

UPDATE: This post was originally posted in May 2007 but since has been updated to cover the more recent release of Mapserver version 5.0.0.

Most of our recent posts have focused on topics relating more to the components of a mapping application then on the maps and data. This post begins the first of several posts discussing free and open source mapping software applications. After introducing each software, we will explore various ways to create applications around them.

Introduction to MapServer

One of the most popular open source GIS applications is MapServer. Initially developed by the University of Minnesota, MapServer has evolved into a fast and easy-to-use internet map server.

“MapServer is an Open Source development environment for building spatially-enabled internet applications. MapServer is not a full-featured GIS system, nor does it aspire to be. Instead, MapServer excels at rendering spatial data (maps, images, and vector data) for the web.” –

Create Your Own Web Mapping Site in 10 Minutes

We just need to setup MapServer to run on a local machine for now and the best way to do that is to use MapServer for Windows (MS4W). This package is a all-in-one web mapping environment. It comes complete with Apache Web Server, PHP, MapServer, and other open source GIS utilities. Here’s how to set it up and add a “Google Maps”-like interface (using ka-Map) in under 10 minutes . I won’t describe the details of how everything interacts because you don’t really have to know right now. It just works.

  1. Download the MS4W PHP5 Base Installer v2.2.6 (Sept 18,2007) from here.
  2. Unzip the file to the root of your C:\ drive and this will create a folder C:\ms4w.
  3. For some initial data, download the PHP/MapScript Sample Application here. The zip file is named
  4. Again, unzip this file at the root of your C:\ drive and it will automatically be placed into the folder C:\ms4w\apps\gmap.
  5. Download the ka-Map Javascript API from the same page. This file is named
  6. Again, unzip this file to the root of your C:\ drive and it will automatically be placed into the folder C:\ms4w\apps\ka-map-1.0.
  7. Navigate to C:\ms4w and double-click on the file named apache-install.bat. In one-click, you’ve setup your web server and MapServer is ready to use.
  8. Open your web browser and goto http://localhost/. You should see an Introduction to MapServer 4 Windows page.
  9. Scroll to the bottom of the page and click the ka-Map Sample Interface link. This will load up the sample application we downloaded in step 3 using the ka-Map interface. The map should look like this:


Congratulations! You’ve just setup a mapping website. In short, ka-Map is basically a web page front-end for MapServer that is similar to Google Maps. MapServer is used to generate map images in the form of map tiles and ka-Map then presents them to the user so they can pan, zoom, identify, and search the map. More details to follow in later posts.

Continue to part 2