[Mapserver-users] Layer status problem and reference map problem..

AMC Story s9646183 at sms.ed.ac.uk
Fri Jul 18 11:46:34 EDT 2003


Hi there, 

I've got a couple of questions which I think must be fairly straight-forward 
but I can't seem to figure them out myself.....

Firstly, I've set up some checkboxes in the HTML interface which should allow 
users to turn certain layers on and off.  I have a couple of layers that are 
always on (i.e. set to DEFAULT in the map file), and a couple of others which 
are set to OFF in the map file, but which the user can select to be turned on.  
The selected layers are passed with the URL and populate an array called 
@layers.  I've then used the following code to update the status of these 
layers:

##Turn on appropriate layers
foreach $layer (@layers){
$current_layer = $current_map->getLayerByName('$layer');
$current_layer->{status} = $mapscript::MS_ON;
}

I've printed the status to the screen and for each layer that was selected, the 
status was updated to "1" as I expected.

The map is then drawn as follows:

#draw and save main map to PNG
$image = $current_map->draw();
$image->saveImage($image_path.$image_id,$mapscript::MS_PNG,
$current_map->{transparent}, $current_map->{interlace}, 0);

However, this map only displays the layers that were set as "DEFAULT" in the 
map file, and the newly-updated "on" status for the other layers seems to be 
ignored.  Do I have to do something else to get these layers to be displayed?

Also, once the main map has been created, I then create a reference map like so:

#Create reference map image
$ref_img = $current_map->drawReferenceMap();
$ref_img->saveImage($image_path.$ref_image_id,$mapscript::MS_PNG,
$current_map->{transparent}, $current_map->{interlace}, 0);

The problem here is that the reference map often doesn't update itself, which 
would obviously be quite disconcerting for the user.  The reference map can be 
made to update if you click on the browser's refresh/reload button, but surely 
this shouldn't be necessary?

Any ideas would be great.

Thanks,
Ali



More information about the mapserver-users mailing list