[mapserver-users] variable substitution

thomas bonfort thomas.bonfort at gmail.com
Thu May 17 08:00:25 PDT 2012


Either:

- use relative paths
- INCLUDE a mapfile snippet that contains only your SHAPEPATH
- Use runtime substitutions, eg:
  DATA "%basedir%/rasters/foo.tif"
(not recommended, unless you carefully validate the %basedir% substitution)
- use sed when deploying:
  DATA "%%BASEDIR%%/rasters/foo.tif"
then
  sed -i 's#%%BASEDIR%%#/path/to/base#' mapfile.map

there are probably other solutions to...

--
thomas

On Thu, May 17, 2012 at 4:46 PM, Puneet Kishor <punk.kish at gmail.com> wrote:
> So, http://mapserver.org/mapfile/variable_sub.html details how I can do variable substitution using either cookies or CGI params. My problem is slightly different, and I am hoping one of you wizards must have solved it already so you could help.
>
> I have mapfiles on my development machine with one set of path names. These mapfiles, along with the rest of the application, are pushed to a git repo, and then pulled down to the production server where, unfortunately, the path names are different. Short of maintaining two sets of mapfiles, how can I do a variable substitution in the path name so everything works.
>
>
>
> --
> Puneet Kishor_______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users



More information about the MapServer-users mailing list