Geographic Information Systems Asked on July 22, 2021
I am building a map that you can hover over and click on. I need to access a feature’s project number (ProjectNum) when I click on it, but my click event on the layer doesn’t seem to be firing. When I click the map, I get all of the feature layer’s project numbers, not the one that I want. How do I retrieve the specific project number of the polygon that I click on?
function clickMap(){
layer.on("update-end", function(evt){
console.log(evt);
map.on("click", function(e){
console.log(e);
console.log("project number: " + layer.graphics[0].attributes.ProjectNum);
});
})
}
You have to listen to the "click" event on the feature layer :
layer.on("click", function(evt){
console.log(evt.graphic.attributes.ProjectNum);
});
Answered by LMokrane on July 22, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP