[mapserver-users] Change CLASS Expression using MapScript

Dash jimlug at co.clackamas.or.us
Mon Oct 12 19:29:55 EDT 2009


Hey there folks,

I am banging my head against this problem for sometime now.  I have a
MapFile that is set up to deliver WMS layers when requested through
OpenLayers.  Within my web page I am trying to change the Class Expression
(MapScript/PHP).  Below is the method I am using to gain access to the Class
and change the expression.  I am performing this before I enter a body tag. 
The body tag has a onload event that fires off the parameters/layers I am
using within OpenLayers and makes the call to the WMS layers within my
MapFile.  Am I missing something here?  I thought since I am declaring the
expression before I'm displaying the map everything would be ok.  I've even
retrieved the edited expression and it should work.  The only thing I can
imagine is that it has something to do with a WMS setting.  Any help would
be greatly appreciated.  Thanks.

<head>
.
.
.
</head>

<?php
$situsEnc = $_POST['home'];
$situs = urldecode($situsEnc);

$map_path="/something/other/than/dirty/socks/wms/";
$map = ms_newMapObj($map_path."schools.map");

$mafLyr = $map->getLayerByName('maf');
$mafLyr->open();
$mafClass = $mafLyr->getClass(0);
$mafClass->setExpression("('[situs]' = '" . $situs . "')");
$mafLyr->close();

<body onload=i"nit()">
  <div id="map"></div>
</body>
-- 
View this message in context: http://n2.nabble.com/Change-CLASS-Expression-using-MapScript-tp3811433p3811433.html
Sent from the Mapserver - User mailing list archive at Nabble.com.


More information about the mapserver-users mailing list