Mapbox 添加带有 Geoserver WFS 的图层与 BBOX 绑定

发布于 2025-01-17 06:53:41 字数 907 浏览 5 评论 0原文

我尝试将 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文