<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Consolas",serif;
        color:black;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#002060;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=EN-US link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Calibri",sans-serif;color:#002060'>Thank you Toni.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Calibri",sans-serif;color:#002060'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Calibri",sans-serif;color:#002060'>I’ll try and will post here if it works.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Calibri",sans-serif;color:#002060'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Calibri",sans-serif;color:#002060'>Regards.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Calibri",sans-serif;color:#002060'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Calibri",sans-serif;color:#002060'>JJ.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Calibri",sans-serif;color:#002060'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext'>From:</span></b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext'> openlayers-users-bounces@lists.osgeo.org [mailto:openlayers-users-bounces@lists.osgeo.org] <b>On Behalf Of </b>toni hernández<br><b>Sent:</b> Thursday, October 08, 2015 3:35 AM<br><b>To:</b> openlayers-users@lists.osgeo.org<br><b>Subject:</b> Re: [OpenLayers-Users] Layer name<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-family:"Arial",sans-serif'>Jair,<br><br>I am not an expert...if this doesn't work, I hope someelse helps you.<br>I am sure there are other ways to achive this.<br><br>once said that,<br><br>When creating your layers you need to add an "id" attribute. See the example bellow.<br>Then, use get the onclic mouse event, and<br><br><br>earthQuakeLayer = new ol.layer.Vector({<br>  source: new ol.source.Vector({<br>    ....<br>  }),<br>  id:'yourlayerid' <br>});<br><br>Then , when listening the clic event, you need to use something similar to this.<br><br>    <br>map.on('click', function (e) {<br>  map.forEachFeatureAtPixel(e.pixel, function (feature, layer) {<br>  console.debug(layer.get('id'));<br>  });<br>}    <br><br><br><br></span><b>Toni Hernández Vallès</b> <o:p></o:p></p><div><p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:8.5pt'>Servei de Sistemes d'Informació Geogràfica i Teledetecció<br>-<br>Universitat de Girona<br><b>SIGTE</b><br>-<br>Pl. Ferrater Mora 1<br>17071 Girona<br>Tel +34 972 418 039 (7026 intern)<br><a href="mailto:toni@sigte.udg.edu">toni@sigte.udg.edu</a> <br><br><a href="http://www.sigte.udg.edu">http://www.sigte.udg.edu</a><br>Twitter <a href="http://twitter.com/SIGTE_UDG">http://twitter.com/SIGTE_UDG</a></span><o:p></o:p></p></div><div><p class=MsoNormal>On 05/10/2015 21:30, Jair Santos wrote:<o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Hello,</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>In a multi-layer map how to determine the clicked layer name when the user click on the map?</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Thanks,</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>JJ.</span><o:p></o:p></p></div></div><p class=MsoNormal><br><br><br><o:p></o:p></p><pre>_______________________________________________<o:p></o:p></pre><pre>Users mailing list<o:p></o:p></pre><pre><a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><o:p></o:p></pre><pre><a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><o:p></o:p></pre></blockquote><p class=MsoNormal><o:p> </o:p></p></div></body></html>