Esri / landscape-modeler-js

A JavaScript web application for designing, running, and saving weighted overlay models using the Esri ArcGIS API for JavaScript and ArcGIS Server image services.
http://landscapemodeler.arcgis.com/
Apache License 2.0
29 stars 17 forks source link

Let's add a legend to the map using the ImageService\Legend capability #16

Open gbrunner opened 10 years ago

gbrunner commented 10 years ago

My users commented that they'd lke to see a Legend with the Image Service layer on the map. I noticed that in the Rest API, Legend is a Child resource of the Image Service. I was wondering if we could use this to show and update a legend on a map after every model is run.

tomwayson commented 10 years ago

Good idea. I see that the legend resource includes a parameter for the rendering rule, so it's promising that we could pass along the model parameters to the raster function and get a legend that reflects the model output:

http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Legend_Image_Service/02r3000001m4000000/

I have not tried this myself, but I would suspect that if that works, the legend would look a lot like (if not exactly like) the color ramp already in the app. Worth testing. Could be useful for reports etc.

gbrunner commented 10 years ago

This might be particularly helpful when previewing individual layers. When you preview, you don't see the color ramp on the layer list.

tomwayson commented 10 years ago

That's an interesting use case.

Though in the long run I've got another idea for preview. I think it would be cool for the "preview" mode allow users to adjust the layer classification and see the results on the map for just that layer.

This could even be done via client-side raster functions (calling to the server-side raster function w/ 1 layer at 100%), see Defining a raster function template on client side:

http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000000rv000000

Tom