[OpenLayers-Users] Displaying message when certain layer is checked

Sveen Atle Frenvik (Geomatikk IKT) Atle.Frenvik.Sveen at geomatikk.no
Thu Jul 22 05:47:04 EDT 2010


On 07/22/2010 10:58 AM, M. Rizwan Khan wrote: 

	Hi All,
	
	I am new bee to Openlayer. 
	I have a simple problem, I want whenever someone checks a certain layer to display, message is displayed to about that layer.
	I dont know how to do to so.........
	
	Thanks in advance,
	Rizwan
	
	
	
	_______________________________________________
	Users mailing list
	Users at openlayers.org
	http://openlayers.org/mailman/listinfo/users
	  

Register a listener for the "changelayer" event on the map I guess is what you want.

Something along the lines of

map.events.register("changelayer", this, changelayer);

function changelayer(evt){  
    if(evt.property == "visibility" && evt.layer.getVisibility()){
        console.log("layer " + evt.layer.name + " activated");
    }
    
}


hope this helps you along

-atle

-- 
Atle Frenvik Sveen
Utvikler
Geomatikk IKT AS
tlf: 45 27 86 89
atle.frenvik.sveen at geomatikk.no
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100722/8879fad5/attachment.html


More information about the Users mailing list