14 May 2011 - Denver (GINA)
This week I had a presentation at the USGS national map about WMS and Tiling. This prompted me to finish my thoughts on my CGI wrapper script I use for my WMS feeds.
The MapServer folks provide a basic cgi wrapper to get people started. Nice, simple, gets the job done and provides a default mapfile.
I am a big fan of easy to remember paths that don’t leak my secrets. My mapwrapper.rb makes it easy to maintain a set of mapfiles with easy to remember aliases. Perhaps some examples to illustrate what I don’t like followed by what I like.:
Typical get capabilities URL for a WMS:
http://server/cgi-bin/mapserv.cgi?REQUEST=GetCapabilities&MAPFILE=/home/rufis/maps/bluemarble-test.map&SERVICE=WMS
A user might be told this is the official URL for the WMS:
http://server/cgi-bin/mapserv.cgi?MAPFILE=/home/rufis/maps/bluemarble-test.map&SERVICE=WMS
Perhaps the WMS admin will be kind and use the default capabilities of the simple CGI wrapper by creating a copy of the mapserv.cgi with a default mapfile like:
http://server/cgi-bin/bluemarble.cgi
Long and cumbersome to remember (for anybody other than our WMS admin Rufis), gives away the fact Rufis is hiding away the maps in their home directory, and you might end up with a huge pile of different CGI scripts in the cgi-bin.
Instead I think the following url is sexier:
http://server/map/bluemarble
Eaiser to read, easier to remember, easier to say verbally. Added benefit of defaulting to GetCapabilities because I’m too lazy to have to type REQUEST=GetCapabilities&SERVICE=WMS
. I’d rather if nothing is specified as a REQUEST it defaults to GetCapabilities and defaults to WMS for SERVICE since most of my MapServer activities are WMS.
The way I make this magic happen is via my Ruby mapwrap.rb
CGI with a dash of Apache Alias tossed in.
Installation really should be as simple as:
I’ve got the GitHub wiki and issues enabled for mapwrap, so feel free in helping me get this into a polished up tool that I can be proud of.