[Mapbender-users] Getting info on layer status, selected or not?

Christoph Baudson christoph.baudson at wheregroup.com
Wed Feb 25 05:20:46 EST 2009


Hi Arne,

Kesting, Arne schrieb:
> Hello,
>
> this is the problem:
> I want to adjust the pdf print output according to the layer which is
> currently selected.
> Here is a small example. 
> If layer A is selected i want to write text1 into the mapframe (pdf
> output) an if layer B is selected,
> please write text2 into the mapframe.
> How can i get the status or info of a specific layer? Is it selected(on)
> or not (off)?
> Everything should be implemented into an already user-defined
> mod_printPDF_pdf.php file.
>
> I don't know how to access the above mentioned information about the
> layers.
> Thanks for any help on this topic.
>   

This will be a bit tricky. You would need to send the status information 
of your layers to the server side PHP.

The layers are stored in a wms object, which itself is stored in a map 
object. The layer attribute you want to query is "gui_layer_visible". 
Assume you know the name of your map , which is presumably "mapframe1", 
the WMS ID in the database (let's say, 543), and the layer name 
("myLayerName") here's a JavaScript code snippet.

var layer = mb_getLayerObjByName("mapframe1", 543, "myLayerName");

You'll find the function in map.js. Take a look at the file in order to 
learn more. You might also want to take a look at map_obj.js, where the 
wms and layer object are defined. You can retrieve the attribute like this

var myLayersVisibility = layer.gui_layer_visibile;

You could then set the value a hidden form field to myLayersVisibility, 
and by this, send it to the server side.

This is all a bit awkward, as the print module doesn't yet use AJAX. I 
hope this helps at least a bit.

Christoph


> best regards
> Arne Kesting
>
> _______________________________________________
> Mapbender_users mailing list
> Mapbender_users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapbender_users
>   


-- 

----------------------------------

 FOSSGIS Konferenz 2009
 17.-19. März 2009 in Hannover
 http://www.fossgis.de/konferenz

---------------------------------- 

_______________________________________

W h e r e G r o u p GmbH & Co. KG

Siemensstraße 8
53121 Bonn
Germany

Christoph Baudson
Anwendungsentwickler

Fon: +49 (0)228 / 90 90 38 - 15
Fax: +49 (0)228 / 90 90 38 - 11
christoph.baudson at wheregroup.com
www.wheregroup.com
Amtsgericht Bonn, HRA 6788
_______________________________________

Komplementärin:
WhereGroup Verwaltungs GmbH
vertreten durch:
Olaf Knopp, Peter Stamm
_______________________________________



More information about the Mapbender_users mailing list