[Mapserver-users] Mapfile, setting Mapfile Header Attributes OTF w/ PHP MapScript...

Chip Hankley Chip.Hankley at rmtinc.com
Mon Sep 22 12:22:41 EDT 2003


NOTE:

I'm still working in 3.6...

We have an application that runs both internally and externally. The
app is identical in every way EXCEPT in it's location on the server
(i.e. internal runs on our Intranet box, external on our Internet box).

On the external box, the path to my application is slightly different:

For instance:

SYMBOLSET "G:\Inetpub\wwwroot\rmtweb\MSym\symbol.sym" on the INTERNET
box, and
SYMBOLSET "G:\Inetpub\wwwroot\MSym\symbol.sym" on the INTRANET box.

What I was trying to set up was a function that would allow me to use
exactly the same mapfiles on both boxes by dynamically changing the
header information on the fly... something like this:

$map = ms_newMapObj("test.map");
setup_mapfile($map);

function setup_mapfile($map) {
  if ($_SERVER["COMPUTERNAME"] == "RMTWEB") { //The external box
    $FONTSET =
"G:\\Inetpub\\wwwroot\\rmtweb\\MSym\\fonts\\fonts.list";
    $SYMBOLSET = "G:\\Inetpub\\wwwroot\\rmtweb\\MSym\\symbol.sym";
    $SHAPEPATH = "G:\\Inetpub\\wwwroot\\rmtweb\\g35688\\GIS\\data\\";
    $IMAGEPATH = "G:\\Inetpub\\wwwroot\\rmtweb\\tmp\\";
  }
  elseif ($_SERVER["COMPUTERNAME"] == "RMTINT") {//The internal box
    $FONTSET = "G:\\Inetpub\\wwwroot\\MSym\\fonts\\fonts.list";
    $SYMBOLSET = "G:\\Inetpub\\wwwroot\\MSym\\symbol.sym";
    $SHAPEPATH = "G:\\Inetpub\\wwwroot\\g35688\\GIS\\data\\";
    $IMAGEPATH = "G:\\Inetpub\\wwwroot\\tmp\\";
  }
  $map->setFontSet($FONTSET);
  $map->setSymbolSet($SYMBOLSET);
  $map->set("shapepath",$SHAPEPATH);
  $map->web->set("imagepath", $IMAGEPATH);
}

This, however, doesn't work, b/c as soon as the mapfile declaration
looks at the mapfile, it runs across symbol definitions that it can't
find a definition for... i.e. MapServer is checking the mapfile before I
can fix the problems with the "setup_mapfile" function. I tried putting
an "@" in front of the mapfile declaration, but this doesn't help b/c
the error is fatal (so I never get to the function).

Anyone know of a way around this?

TIA!

Chip Hankley



Outgoing messages, along with any attachments, are scanned for viruses at RMT prior to sending.
------------------------------------------------------------------------------
NOTICE--This email may contain confidential and privileged information 
for the sole use of the intended recipient.  Any review or distribution
by others is strictly prohibited.  If you are not the intended recipient,
please contact the sender immediately and delete all copies.



More information about the mapserver-users mailing list