Dynamic Legend Generation From An Image Map Services
You can see the national weather warnings that NOAA publishes here . If you look at the page, you will notice that _all_ the legend swatches and text are presented under the map and you are left to your own means of locating the associated colors between the map and the legend grid to figure out what is on the map. It would be nice if the legend grid could be dynamically generated to list only the swatch colors and their descriptions based on what is on the map. This is what this post tries to solve. So NOAA publishes the national weather service maps as Esri ArcGIS REST endpoints . Using an instance of an ArcGISDynamicMapServiceLayer subclass, I can intercept the reponse image. Once I have the image bitmap data, I can get a histogram of the color distribution. Now using NOAA color map , I can associate a color with a description and populate a legend UI component. Check out the application in action here . The legend located on the top right corner is not fully transparent, roll the m...