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

Geoffrey Rowland geoffrey.rowland at noaa.gov
Tue Sep 9 08:31:20 PDT 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?  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.<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>
          $myMap = ms_newMapObj("wnv.map");<br>
          $countyLayer = $myMap->getlayerbyname(counties);<br>
          $countyLayer->set("status",0);<br>
          $myMap->selectOutputFormat("PNG");<br>
          $image=$myMap->draw();<br>
          $image_url=$image->saveWebImage();<br>
<br>
<br>
layer portion of map file<br>
<br>
<br>
LAYER<br>
  NAME counties<br>
  METADATA<br>
    "DESCRIPTION" "Counties"<br>
  <br>
  END<br>
  TYPE POLYGON<br>
  STATUS ON<br>
  DATA counties<br>
<br>
CLASSITEM 'Pop1999'<br>
NAME Pop1999<br>
TEMPLATE us_pop.html<br>
CLASS<br>
  EXPRESSION ([Pop1999] > 0 and [Pop1999] < 5284)<br>
  COLOR 255 255 229<br>
  OUTLINECOLOR 0 0 0<br>
END<br>
<br>
END # end class<br>
  <br>
END # end layer<br>
</body>
</html>

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




More information about the MapServer-users mailing list