Prem
Prem

Reputation: 31

Mapbox Add Layer with Geoserver WFS binding with 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

Upvotes: 3

Views: 1941

Answers (0)

Related Questions