With no options, the default map is shown.
The default map shown at half size. (Due to the size of the map control icons, it would probably be preferable to reduce the number of zoom levels if a map this size were to be used in earnest.)
A map showing a single marker.
The same map, zoomed in to level 5 (out of 8).
A marker file read from an HTTP URL.
Example of the map service embedded in a page via an IFrame. View source to see how this is used.
The Map Service supports the following optional URL query string arguments for controlling the map output:
|extent||minx miny maxx maxy||The extents of the image, given in the current projection. Defaults to the entire world.|
|size||width height||Map size in pixels. Should be approximately 2:1. Defaults to 750 x 355 pixels.|
|zoom||zoom_level [center_x center_y]||If provided, the returned map is zoomed to the given zoom level, centered on the image x and y coordinates, based on the current map extents.|
|center||lat lon||If provided, the map is centered on the given lat/lon (and
the center_x and center_y params given to
|marker||lat,lon,symbol,color,size,name,font,link||The format of the marker specification is described below. More than one marker can be specified in a single URL.|
|marker_url||url||The URL of a text file, containing marker specifications (as described below), one per line. Although only one marker_url can be specified per request, the marker_url and marker options can be combined.|
A marker specification is used to determine the look and behavior of each supplied marker. The marker specification takes the form of a list of comma-separated fields in the following order:
|lat||Latitude of the marker point.||Yes||None|
|lon||Longitude of the marker point.||Yes||None|
|symbol||Name of the marker symbol.||Yes||None|
|color||Six-digit hex RGB color value, with leading hash mark.||No||#FF0000|
|size||Size of the marker in pixels.||No||20|
|name||Text label for the marker.||No||None|
|font||Font to be used for the label, if provided.||No||univers|
|link||URL to link the symbol to. If no URL is provided, the marker is plotted but not hyperlinked.||No||None|
Any optional marker specification field can be left blank if desired. If the remainder of the options in a given marker spec are unused, the line can be truncated after the last option used. The label is presently rendered at a font size half that of the marker.
The following symbols are taken from TrueType cartography fonts and are shown at 32 pixels wide, although they can be rendered at any size. More symbols can be added or replaced on request. A maximum of 60 symbols can be defined. An additional symbol, 'solid', is supported if a simple colored dot is required.
The following TrueType fonts are supported, but more can be added easily.
Under the hood, the
surfer.cgi script makes use of the
mapserv.py module in the same directory.
The strictly necessary files in that directory include:
|mapserv.py||This python module does all the heavy lifting, providing the mapserv.Map class as a wrapper around mapscript.mapObj. See the internal documentation and MapScript API docs for more details.|
|surfer.cgi||This Python CGI script calls mapserv.py with a pointer to the MapFile configuration, the Cheetah UI template, and the number of zoom levels to use.|
|surfer.html||The template for the DHTML UI. See the Cheetah users' guide for more information on how this template is constructed.|
|surfer.map||This file contains the current MapFile definition used by the map service, which controls the appearance and contents of the generated maps. See the MapServer MapFile reference for more details.|
|nav/||The nav/ directory contains all of the images used in the UI controls.|
|symbolset.txt||This text file contains the symbol definitions used by the map service, as described in the MapServer MapFile reference.|
|fonts.txt||This text file contains the TrueType font definitions, one per line.|
The following files are optional, but potentially useful:
|mkfontstxt||This shell script can be used to regenerate the
|blue_marble.gif||A nice base image for a reference map, if we ever add one.|
|iframe.html||An IFrame usage example for embedding the map inside another page.|
|cities.txt||An example marker file.|
The data, including several gigs of tiled VMap0 vectors in ESRI Shapefile
format, live in
/www/gisdata. PostGIS is currently not
needed for this application.
One final technical note is that image tiles will pile up in the
/www/html/mstmp directory and need to be removed periodically.
A simple cron job has been installed in the root user's crontab on that
machine to accomplish this on a nightly basis:
05 01 * * * find /www/html/mstmp -ctime +1 | xargs rm