Thank you Toni.
Ill try and will post here if it works. Regards. JJ. From: openlayers-users-boun...@lists.osgeo.org [mailto:openlayers-users-boun...@lists.osgeo.org] On Behalf Of toni hernández Sent: Thursday, October 08, 2015 3:35 AM To: openlayers-users@lists.osgeo.org Subject: Re: [OpenLayers-Users] Layer name Jair, I am not an expert...if this doesn't work, I hope someelse helps you. I am sure there are other ways to achive this. once said that, When creating your layers you need to add an "id" attribute. See the example bellow. Then, use get the onclic mouse event, and earthQuakeLayer = new ol.layer.Vector({ source: new ol.source.Vector({ .... }), id:'yourlayerid' }); Then , when listening the clic event, you need to use something similar to this. map.on('click', function (e) { map.forEachFeatureAtPixel(e.pixel, function (feature, layer) { console.debug(layer.get('id')); }); } Toni Hernández Vallès Servei de Sistemes d'Informació Geogràfica i Teledetecció - Universitat de Girona SIGTE - Pl. Ferrater Mora 1 17071 Girona Tel +34 972 418 039 (7026 intern) t...@sigte.udg.edu <mailto:t...@sigte.udg.edu> http://www.sigte.udg.edu Twitter http://twitter.com/SIGTE_UDG On 05/10/2015 21:30, Jair Santos wrote: Hello, In a multi-layer map how to determine the clicked layer name when the user click on the map? Thanks, JJ. _______________________________________________ Users mailing list us...@lists.osgeo.org <mailto:us...@lists.osgeo.org> http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________ Users mailing list us...@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/openlayers-users