[Mapserver-users] setting layers on/off using phpmapscript

Geoffrey Rowland geoffrey.rowland at noaa.gov
Tue Sep 9 11:31:20 EDT 2003


This is a multi-part message in MIME format.
--------------040807010609060502010206
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Am I doing something wrong?  The following code gives me an error.  
Since I don't have 78 lines of code in my php file, I'm assuming 
something in my .map file may be causing this error.  However if I take 
out the php code trying to set the layer status, the map will render fine.

Fatal error: Object expected as argument. in 
D:\Inetpub\rootbeta\map_engine\wnvfetchmap.php on line 78

          $myMap = ms_newMapObj("wnv.map");
          $countyLayer = $myMap->getlayerbyname(counties);
          $countyLayer->set("status",0);
          $myMap->selectOutputFormat("PNG");
          $image=$myMap->draw();
          $image_url=$image->saveWebImage();


layer portion of map file


LAYER
  NAME counties
  METADATA
    "DESCRIPTION" "Counties"
 
  END
  TYPE POLYGON
  STATUS ON
  DATA counties

CLASSITEM 'Pop1999'
NAME Pop1999
TEMPLATE us_pop.html
CLASS
  EXPRESSION ([Pop1999] > 0 and [Pop1999] < 5284)
  COLOR 255 255 229
  OUTLINECOLOR 0 0 0
END

END # end class
 
END # end layer

--------------040807010609060502010206
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
Am I doing something wrong?&nbsp; The following code gives me an error.&nbsp;
Since I don't have 78 lines of code in my php file, I'm assuming
something in my .map file may be causing this error.&nbsp; However if I take
out the php code trying to set the layer status, the map will render
fine.<br>
<br>
<b>Fatal error</b>: Object expected as argument. in <b>D:\Inetpub\rootbeta\map_engine\wnvfetchmap.php</b>
on line <b>78</b><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $myMap = ms_newMapObj("wnv.map");<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; $countyLayer = $myMap-&gt;getlayerbyname(counties);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; $countyLayer-&gt;set("status",0);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; $myMap-&gt;selectOutputFormat("PNG");<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; $image=$myMap-&gt;draw();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; $image_url=$image-&gt;saveWebImage();<br>
<br>
<br>
layer portion of map file<br>
<br>
<br>
LAYER<br>
&nbsp; NAME counties<br>
&nbsp; METADATA<br>
&nbsp;&nbsp;&nbsp; "DESCRIPTION" "Counties"<br>
&nbsp; <br>
&nbsp; END<br>
&nbsp; TYPE POLYGON<br>
&nbsp; STATUS ON<br>
&nbsp; DATA counties<br>
<br>
CLASSITEM 'Pop1999'<br>
NAME Pop1999<br>
TEMPLATE us_pop.html<br>
CLASS<br>
&nbsp; EXPRESSION ([Pop1999] &gt; 0 and [Pop1999] &lt; 5284)<br>
&nbsp; COLOR 255 255 229<br>
&nbsp; OUTLINECOLOR 0 0 0<br>
END<br>
<br>
END # end class<br>
&nbsp; <br>
END # end layer<br>
</body>
</html>

--------------040807010609060502010206--




More information about the mapserver-users mailing list