MapScript: Turn layers on/off

Stephen Lime steve.lime at dnr.state.mn.us
Mon Jul 24 19:47:09 PDT 2000


To turn a layer on you must explicitly set its status to ON. In perl the syntax is  $layer->{status} = $mapscript::MS_ON; then you can draw and so on.

And, yes you can create lauers using MapScript. See the example perl script in the new demo (in the  perl sub-directory) for an example.

Steve

>>> "Michael Anderson" <m_anderson14 at hotmail.com> 07/24/00 19:44 PM >>>
Hello,

I am trying to use MapScript to turn layers on and off and am having no 
luck. I have a feeling the problem may be the order I an doing things, but I 
have tried several combinations with no luck. Here is what I want to do

$map=new MapObj("anymap.map")
$img=$map->draw()
$layer=$map->getLayerByName("layerName")
$layer->draw($map,$img)
mapscript::msSaveImage($img,"image.gif",1,1)

I am using Python, not Perl, so there may be a few errors in the code. I 
don't really know Perl. I have tried using prepareImage before making the 
image, redoing the $map->draw()after turning the layer on, and a few other 
combinations I can't remmeber now. Can someone set me straight?

Tomorrow I am plan to try to add layers to a map using MapScript. Is this 
possible?

Thanks,
Mike


________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com





More information about the MapServer-users mailing list