通过hitTest()方法可以获取到地图上图层的几何要素
view.on(['click'], function(event) {
view.hitTest(event).then(function(response) {
if (response.results.length) {
var graphic = response.results.filter(function(result) {
return result.graphic.layer === nodesGraLayer || result.graphic.layer === allPipesGraLayer
})[0].graphic;
if (graphic) {
// 在此操作
console.log(graphic)
}
}
});
})