[mapserver-users] Relative path's in mapfile

Richard Greenwood richard.greenwood at gmail.com
Tue Jan 24 18:16:45 PST 2012


2012/1/24 Juan Jesús Cremades Monserrat <relicary at gmail.com>:
> Hi!
>
> I'm creating a new mapfile and when I arrive to the WMS_ONLINERESOURCE
> tag  the "map" paremeter at the URL I would like i'll be a relative path,
> non an absolute.
>
> For example, now my mapfile is like this:
>
> "wms_onlineresource"
> "http://localhost:80/cgi-bin/mapserv.exe?map=C%3A%5CFiles%5Capps%5Cdemo%5CdemoCV.map"
>
> And the great solution could be:
>
> "wms_onlineresource"
> "http://localhost:80/cgi-bin/mapserv.exe?map=%5Capps%5Cdemo%5CdemoCV.map"
>
> Is it possible? Thanks

I believe the map file path is relative to mapserv.exe. You can test
this yourself.

A more common and flexible approach is to set and environment variable
in your Apache httpd.conf file, for example
  SetEnv MYMAP   "C:/Files/apps/demo/demoCV.map"
Those are forward slashes not back slashes even though it's Windows.
And your URL is now
  http://localhost:80/cgi-bin/mapserv.exe?map=MYMAP
This is considered to be more secure because you are not exposing your
file system path to the public.

Rich
-- 
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com



More information about the MapServer-users mailing list