在 Angular 10 中点击 ArcGIS 地图时,我们如何获取图层的详细信息。点击事件在地图上触发。例如:显示门牌号码的地图。在地图上单击其中一个门牌号时,我们如何获得门牌号。我必须在我的代码中使用“门牌号”来实现其他功能。
this._view.on('click', function (event) {
console.log('click working');
//Need to get the value of clicked layer.
});
/更新代码/
this._view.on('click', function (event) {
this._view.hitTest(event).then(function (response) {
const graphic = response.results.filter(function (result) {
// return result.graphic.layer === hurricanesLayer;
return result.graphic.layer;
})[0].graphic;
console.log(graphic.attributes);
});
});
我收到错误消息“未捕获的类型错误:无法读取未定义的属性 '_view'”