Hi ESRI Community.
We would like our WFS requests from the JavaScript library to use the bbox parameter, requesting just the features in the current window. Currently the request brings back all the features which for a some layers is not viable as it could mean requesting 100s of Mbytes.
We thought that the mode parameter might help but get a read-only exception when doing the following.
// create and add a WFSLayer to the map
const layer = new WFSLayer({
url: "https://geobretagne.fr/geoserver/ows", // url to your WFS endpoint
name: "fma:bvme_zhp_vs_culture", // name of the FeatureType
copyright: "GéoBretagne",
mode:1
});
map.add(layer);
Any ideas how to get around this problem?
We're using MapServer to provide the WFS service.
Hi @LewInMadrid - you can use the customParameters property to use the bbox parameter. There's an example in the documentation here: https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-WFSLayer.html#customParame...
I have same question or similar.
I think @LewInMadrid asks about get bbox dynamically, getting service on demand dynamically. When you are over it in map view
Isaac is right. This only works if the bbox can be sent dynamically as you zoom and scroll around the map. If you have a Gbyte of spatial data it's dynamic bbox or bust.
Ah, I see - you can still do this using customParameters - just update the bbox in the customParameters whenever you change the extent of the view and call refresh(). Here's an example: https://codepen.io/ycabon/pen/GRyqVPp?editors=1000
Thanks for your help.
Now I find that it takes a long time to load the WFS, I see that the server is called 3 times, but I do not understand why.
I would like to be able to call the service only when I move the map or just load it once and then refresh when I move around the map
This is a example of my code:
How can I optimize it so that it takes a short time to load, even if it is reducing the number of features?
thanks again
A little bit late here, but it worked for me, and so it may work for others as well.
You can initialize the WFSLayer with a custom parameter of COUNT=1 to avoid the massive lookup request from the JSAPI web worker:
const layer = new WFSLayer({
url: "https://geobretagne.fr/geoserver/ows",
name: "fma:bvme_zhp_vs_culture",
customParameters: {
COUNT: 1,
},
});
You can than reset this parameter when the layer is loaded successfully.