I'm trying to create a map of our company's sales territories. The territories are organized by zip codes, so I'm using a feature layer that shows all zip codes, but I'm trying to use unique values to color each zip code according to which territory it belongs to. We have some 27K zip codes that we cover. Just sending in the whole array of all 27K zip codes seems to crash it 😅
I've had some luck if I create a separate renderer and feature layer for each territory, but I've only tried it with 3 of the 15 territories (attached pic). When I tried to create a renderer and feature layer for each territory using a forEach loop, this also crashed the map.
Does anyone have any idea of how I could accomplish this client-side? I considered making my own hosted layer, but since we use Azure SQL to manage our data, this is not ideal, nor do we have the zip code polygon coordinates.
symbolList: [
{
symbol: {
color:"crimson",
type:"simple-fill"
},
value: "65564"
},
{
symbol: {
color:"crimson",
type:"simple-fill"
},
value:"72644"
},
etc x 27,000...
]
const zipRenderer = {
type: "unique-value",
field: "ZIP_CODE",
uniqueValueInfos: this.symbolList
}
const featureLayer = new FeatureLayer({
url: "https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Boundaries_2021/FeatureServer/3",
renderer: zipRenderer,
opacity: 0.4,
});
map.add(featureLayer);