Using PHP Mapscript to change DATA for Oracle Spatial

Steve Hall steve.hall at MERCATORGEOSYSTEMS.CO.UK
Mon Nov 15 01:31:32 PST 2004


Hi all,

I'm working with the 4.4.0 beta2 release so i'm not sure if this is a bug, me doing something wrong or it's just not meant to do what i'm trying!

I have an Oracle Spatial layer defined in my map file :

LAYER
  NAME PostcodeData
  GROUP all
  TYPE POLYGON
  STATUS ON
  CONNECTIONTYPE oraclespatial
  CONNECTION "user/pwd at db"
  DATA "GEOM FROM (SELECT B.GEOM, R.RESULTS, B.BASENAME, R.REPORT_ID FROM BASE B, RS_RESULTS_NUMBER R WHERE B.BASEID=R.GEOGID AND R.REPORT_ID = !REPORT_ID!) USING SRID 8192"

[more of the "usual" stuff here]

END

The !REPORT_ID! is a placeholder that I want to replace at runtime with a know value, which I try using a fragment of PHP code like this :

 $map = ms_newMapObj($map_path."thematic.map");
 $dataLayer = $map->getLayerByName("PostcodeData");
 echo $dataLayer->data."<br>";
 $data = str_replace("!REPORT_ID!", "19594", $dataLayer->data);
 echo $data."<br>";
 $dataLayer->data = $data;
 echo $dataLayer->data."<br>";
 $image=$map->draw();

Although the string replace is working fine and it looks like the assignment to $dataLayer->data is working too, when I make the call to draw() then it fails and throws out the SQL stored in the .map file, not the one I have manipulated on the fly.

I have managed to workaround this using the FILTER statement (and corresponding PHP calls) for now but ideally i'd like to prove this can be done at the SQL level as i'm going to be doing more complex alterations to this SQL later on.

Many thanks,

Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20041115/fd363eac/attachment.htm>


More information about the MapServer-users mailing list