Reactjs 如何将单击处理程序传递到特定的贴图层?

Reactjs 如何将单击处理程序传递到特定的贴图层?,reactjs,arcgis-js-api,Reactjs,Arcgis Js Api,我正在尝试访问特定ArcGIS WebMap图层的属性。 我已将单击处理程序附加到WebMap React组件,但我只能从底图访问mapPoint.latitude和mapPoint.longitude值(在事件中) 例如,在第4层中,我希望在单击地图的特定区域时访问“位置名称”的自定义值 简化示例代码: clickHandler = e => { console.log(e.mapPoint.latitude + ", " + e.mapPoint.longitude); }; .

我正在尝试访问特定ArcGIS WebMap图层的属性。 我已将单击处理程序附加到WebMap React组件,但我只能从底图访问mapPoint.latitude和mapPoint.longitude值(在事件中)

例如,在第4层中,我希望在单击地图的特定区域时访问“位置名称”的自定义值

简化示例代码:

clickHandler = e => {
  console.log(e.mapPoint.latitude + ", " + e.mapPoint.longitude);
};

...

<WebMap
  viewProperties={{
    center: [ this.props.latitude, this.props.longitude ],
    zoom: 12
  }}
  mapProperties={{ basemap: "streets" }}
  onClick={e => this.clickHandler(e)}
  id="9a9a9a9aaaccc1234"
/>
clickHandler=e=>{
log(e.mapPoint.latitude+,“+e.mapPoint.longitude);
};
...
此。单击处理程序(e)}
id=“9AACCC1234”
/>

正如您所发现的,单击处理程序只会为您提供映射点坐标


为了从该映射点的特定Featurelayer获取信息,您需要在感兴趣的Featurelayer上执行or操作,使用映射点的坐标作为查询几何体。请参阅文档中有关如何精确执行此操作的示例。

您是否在代码中的某个位置绑定了此。clickHandler?@Rahul-clickHandler工作正常,我只是想知道是否可以将其附加到特定层。