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)
[email protected] <mailto:[email protected]>
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
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users