Mapbox 添加带有 Geoserver WFS 的图层与 BBOX 绑定
我尝试将 geoserver WFS GetFeature 请求与 BBOX 绑定,并将 geojson 层添加到 Mapbox 地图对象,以便每当平移和放大/缩小地图时,都会下载并渲染地图屏幕可见窗口中的 geojson 数据,而不是加载整个表格geojson 数据。这是代码片段。
function geturl(){
return 'http://localhost:8080/geoserver/demo/ows?service=WFS&version=2.0.0&request=GetFeature&typeName=demo:assets&outputFormat=application/json'
+'&bbox='
+map.getBounds().getSouthWest().lat+','
+map.getBounds().getSouthWest().lng+','
+map.getBounds().getNorthEast().lat+','
+map.getBounds().getNorthEast().lng
}
map.on('load', () => {
map.addSource('city_assets', {
type: 'geojson',
data:geturl()
})};
虽然我第一次可以看到这些点仅在查看 BBOX 窗口中加载,但当我放大/缩小或平移时,我没有看到其余点数据被下载和渲染。
如果我错过了任何让它发挥作用的东西,如果有人能指导我,那将非常有帮助。请随时询问更多信息。谢谢。
-普雷姆
Im trying to bind geoserver WFS GetFeature request with BBOX and adding the geojson layer to Mapbox map object so that whenever map is panned and zoomed in/out, the geojson data within the map screen visible window will be downloaded and rendered instead of loading entire table geojson data. Here is the code snippet.
function geturl(){
return 'http://localhost:8080/geoserver/demo/ows?service=WFS&version=2.0.0&request=GetFeature&typeName=demo:assets&outputFormat=application/json'
+'&bbox='
+map.getBounds().getSouthWest().lat+','
+map.getBounds().getSouthWest().lng+','
+map.getBounds().getNorthEast().lat+','
+map.getBounds().getNorthEast().lng
}
map.on('load', () => {
map.addSource('city_assets', {
type: 'geojson',
data:geturl()
})};
Although I could see the points were loaded only in the viewing BBOX window for the first time, I don't see rest of the point data being downloaded and rendered when I zoom in/out or pan around.
It would be really helpful if someone can guide me if I have missed anything to make it working. Please feel free to ask for additional info. Thanks.
-Prem
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论