How to update legend when the data for the layer changes

372
0
03-03-2022 02:00 AM
RehanChaudhary
Occasional Contributor

i am working with imagery layers and i am overwriting this layer and publishing it to the portal using a script. Each time i republish it, the layer has a new data so the old legend that was created for the service is no longer valid. I want to be able to update the legend whenever the service is republished for my map so that i can later use it in apps like Webappbuilder.  I have this workflow in mind.

go through the data which is being used for publishing and search for the values minimum and maximum.

create the layer file and change the symbology using classes based on the maxmim and minimum.

create a legend and publish the data and save to existing map using the script.

 

Unfortunately i am unable to figure out how to do as i am new to the esri API's. my service has a StretchColorizer. i tried changing it and i cannot. Is there a way i can automate this whole procedure of changing the legend based on the new data values in my data? 

0 Kudos
0 Replies