Select to view content in your preferred language

Best workflow for creating client side layer to display results from Query

247
1
02-13-2026 05:12 AM
FranklinAlexander
Frequent Contributor

I am working on a custom Query widget for an Experience Builder application that queries a REST service and displays the results on the map. The map currently contains a county boundaries layer that I would like to use to display the results because I need the geometry from the layer. My challenge is that I need to add 8 new fields to the county boundaries at runtime that contain response data from the query. We currently have a WAB app with a custom widget that does this very thing, but this was more straight forward with the JS 3x api. The 4x api has so many different types feature layers and views with varying degrees of usability, that trying to figure out the best workflow and what layer type to use is making my head explode! It would be nice if I could just create a layer view to the county boundaries, then join a json object containing the new fields with the response data. This would be fast and keep everything client side, but not sure if this is possible. Just looking for general advice right now on the best workflow here so not providing code just yet.

0 Kudos
1 Reply
Sage_Wall
Esri Regular Contributor

Hi @FranklinAlexander,

Great question—there are several approaches you could take here. If your data isn’t in a native layer format like GeoJSON or KML, I’d recommend creating a client-side FeatureLayer (see Creating a FeatureLayer → Add an array of client-side features for details). This approach provides the best compatibility with other SDK features. For something like county boundaries, the pattern shown in this sample is a good fit. If you’re working with a large number of features, you can further improve performance by batching them as demonstrated in this other sample.