We have integrated ArcGIS with our React.js project, where we are using several Feature & Map Server layers to display data on the map. However, we are encountering a challenge with filtering the data at the state level.
The issue is that our layers contain a large amount of worldwide data, and the data properties do not include a "state" field. We need to dynamically filter and display data based on a selected state, but since we do not own the layer, we cannot modify or add properties directly to it.
We have implemented a solution using state geometry to filter the data, but this approach is causing it to first fetch all data from the API endpoint and then show it on the map. We want to show the data as it gets from the API and not wait for the whole data to download.
Reference endpoint:
You can try using the "geometry" and "geometryType" parameters to add a spatial filter to your requests (docs). Assuming the service has a properly maintained spatial index and your query geometry isn't too complex this should give you a much smaller working set.