[Mapbender-users] implement "layer conflicts" - mod_treefolder2.php

karsten vennemann karsten at terragis.net
Tue Apr 8 03:40:24 EDT 2008

Greetings everyone,

I am working on implementing a function that I need for my mapping
application. The map has a lot of polygon layers and for its users it is
very confusing once multiple layers are switched on that are covering each
other. The users have a hard time easily and clearly know which one is drawn
on top on the map.
Thus I want to set layers to "conflict with each other". Turning on a Layer
that has other layers set to be conflicting with it will trigger all
conflicting layers to automatically be switched off.
For example a layer 1)  "Percentage of Poor people age 65 and over in 2000"
will conflict with a layer 2) "Percentage of Poor people age 65 and over in
2007". Thus if layer 1) is turned on layer 2) automatically will be switched
off and so on.
I am working to extended/amend the function "handleSelectedLayer" in
For now I just was testing and learning what the function does thus I did
just set some hard coded conflicts using a new variable like and switched
the layer off if a certain (also hard coded layer) is switched on:

if(layername == "People_in_Institutions_02" && status == 1){
mylayerconflicts[0] = "Percentage_of_People_in_Poverty_per_County_2005";
parent.handleSelectedLayer_array(mapObj, mywms, mylayerconflicts, type, 0);

This does what I wanted to accomplish (the layer is switched off and not
shown on the map any more, however the checkbox in the tree is still

What would be the best way/ a way to uncheck the checkbox as using java
script in the tree ?

Any other Ideas on how to generally best implement this?

I was thinking to implement reading an array/list from a new column in a
database table where each layer could have a list of conflicting layers/
groups of layers stored. The array could then be used in a loop to switch
off all conflicting layers on the client side. Later I also could add an
admin web interface to enter the values for conflicts for each layer.
Karsten Vennemann

More information about the Mapbender_users mailing list