[ka-Map-users] Changing map layer dinamically

Ravi ravikapoor101 at gmail.com
Thu Nov 23 13:57:10 EST 2006



Hi Damiano, I am already doing this. Here is some of my code, hope that 
helps.

function showLayer(layerName) {

var allLayers = myKaMap.getCurrentMap().getAllLayers();

for (var i=0; i<allLayers.length; i++) {
   if(allLayers[i].name == layerName) {
     myKaMap.setLayerVisibility( allLayers[i].name, true );
     // allLayers[i].setVisibility(true) // this has some bug
   } else {
     myKaMap.setLayerVisibility( allLayers[i].name, false );
     // allLayers[i].setVisibility(false) // this has some bug
   }
}

Also, you can set a layer on/off using
   allLayers[i].setVisibility(booleanValue)
but somehow that API was not working very well. Sometimes it will 
display a layer, sometimes it will not.

- Ravi


Damiano Morosi wrote:
> Hi,
> 
> I would like to change the layer in my kaMap by clicking on a link or
> selecting a voice in a combobox.
> Is there some javascript API to do such thing without too much reverse
> engineering of ka-map?
> Thanks,
> 
> Damiano



More information about the ka-Map-users mailing list