These MapServer Recipes are the simplest examples I could come up with for learning how to use MapServer (available at They are written using PHP/MapScript. I assume you already have a working installation of MapServer and PHP/MapScript on your machine (although the first example can be used to find out whether you really do!). Full MapServer documentation is at

Take special note that you will have to edit SHAPEPATH ,IMAGEPATH , and IMAGEURL in each .MAP file to match your own installation. If your web server is not configured to use PHP/Mapscript for .PHTML files, you'll have to reconfigure your server or rename the recipe files.

You can download all the the PHTML and MAP files at , and then follow the links to download the data files from USGS. 

  • Hello World . Draws text only, no data file required.
  • USA1, a simple outline map of the US.
  • USA1a. The same outline map as in USA1, but it has some simple modifications applied in the PHP file to create a different look than what was defined in the original USA1.MAP . Both examples use exactly the same .MAP file.
  • USA1b. Like USA1a, this example uses PHP to modify USA1.MAP , this time to demonstrate some different map projections.
  • USA2, a more complicated map with two US layers (states and timezones), a legend, and a scalebar.
  • USA3, a very simple raster file example.

Data layer download

EMACS mapserver mode

A basic .MAP file mode for GNU Emacs is available at It provides indentation and some keyword highlighting. It has been tested under GNU Emacs but not under Xemacs (although it should work just fine under either editor).