【发布时间】:2021-02-18 12:07:28
【问题描述】:
我使用 react-leaflet 来显示 WMS 层
<WMSTileLayer url="http://localhost:8080/geoserver/cite/wms?service=WMS" {...mapprops2} ></WMSTileLayer>
我使用 geoserver url 来获取数据,但我应该如何将用户点击(纬度、经度或 X 和 Y)传递到此链接并获取数据?
http://localhost:8080/geoserver/cite/wms?service=WMS&version=1.1.0&request=GetFeatureInfo&layers=cite%3Acar&QUERY_LAYERS=cite%3Acar&bbox=-3.2503604888916%2C51.4469833374023%2C-3.165486331575439%2C851575439%2C851. 696&height=768&srs=EPSG%3A4326&format=application/json&INFO_FORMAT=application/json&FEATURE_COUNT=50&X=50&Y=50&STYLES=&WIDTH=101&HEIGHT=101
如何根据用户单击此图层使用 getFeatureInfo 添加弹出窗口? react-leaflet 中是否也有类似 latLngToLayerPoint 的东西?
【问题讨论】:
-
你能告诉我们更多细节吗?你试过什么?
-
@SethLutske 请看新的编辑,我在 react-leaflet 中使用 axios 请求 geoserver url。
标签: reactjs geoserver react-leaflet wms getfeatureinfo