here's a trick to make MapServer URLs shorter

Ken Lord kenlord at GMAIL.COM
Fri Jan 21 14:22:53 PST 2005


Nice job Gregor,

My URL's do get pretty crazy ... there's a lot of things you can do
with URL's that all those php'ers may not know about or may think only
they can do, and your tool looks to streamline the system nicely.

Is there a way to make this work through IIS?

I use some simple ASP pages in my templates that redirect to mapserver
to add power to the URL system, for example to switch between
different templates, different map sizes, to go to specific pre-set
map views, to turn on/off all map layers within sets of layers without
using the 'group' parameter, or to turn off certain layers when other
layers are activated without using the cryptic 'requires' parameter

... Or to process query results. An ASP link parsed in a query results
page can lead to any kind of dynamically generated query result
content you want this way. ... as I'm sure all you php'ers can do too
in your own way.

Cheers,
Ken Lord
Vancouver BC

On Fri, 21 Jan 2005 13:18:20 -0800, Gregor Mosheh
<stigmata_blackangel at yahoo.com> wrote:
> I came up with a solution that I thought would be of
> interest to everybody, so here it is. It seems to work
> well in all the cases we've tested, but of course any
> feedback is welcome.
> 
> Problem: MapServer URLs are horribly long, what with
> all the program= and map= and mode= stuff in the query
> string.
> 
> Solution: Set up an Apache handler and a wrapper
> script, so that an URL pointing to a .map file causes
> MapServer to run instead.
> 
> This is a CGI program. Put it into your cgi-bin
> directory and chmod it. And you'll need to fix a few
> of the paths to match your own installation.
> 
> #!/bin/sh
> 
> # if there's no query string, make a basic one
> # assuming they want browse mode
> if [ "$QUERY_STRING" = "" ]; then
> 
> QUERY_STRING="mode=browse&program=/cgi-bin/mapserv.cgi"
> fi
> export QUERY_STRING
> # the URL they gave is the URL to the mapfile
> # appending the mapfile to the query string
> # helps with browse mode
> MS_MAPFILE=$PATH_TRANSLATED
> export MS_MAPFILE
> QUERY_STRING=$QUERY_STRING"&map=$PATH_TRANSLATED"
> # now just run MapServer now
> exec /usr/local/apache/cgi-bin/mapserv.cgi
> 
> Then, in Apache's httpd.conf file, set up a handler.
> Anything with a .map extension gets sent to that
> wrapper.
> 
> # make MapServer mapfiles "executable"
> Action mapfilewrapper /cgi-bin/mapfilewrappper.cgi
> AddHandler mapfilewrapper .map
> 
> So now instead of this:
> http://server/cgi-bin/mapserv?map=/home/bob/public_html/maps/foo.map&mode=browse&program=/cgi-bin/mapserv
> 
> You should be able to do this:
> http://server/~bob/foo.map
> 
> 
> __________________________________
> Do you Yahoo!?
> All your favorites on one personal page – Try My Yahoo!
> http://my.yahoo.com
>



More information about the MapServer-users mailing list