Closed GoogleCodeExporter closed 8 years ago
Aleda 11/12/2015 - would like to discuss possible ways of accomplishing providing a legend image for tiled layers....
@MassGIS, I doubt you have too much control over something like http://maps.massgis.state.ma.us/map_ol/fema_national_flood_hazard_layer_json.txt to add a new attribute to point me to a custom legend. Or do you?
What if you added something new in http://maps.massgis.state.ma.us/temp/oliver_folderset.xml?
Now it is:
<Layer
title="FEMA National Flood Hazard Layer"
style=""
name="FEMA_FEMA_National_Flood_Hazard_Layer"
type="tiled_overlay"
agol="http://maps.massgis.state.ma.us/map_ol/fema_national_flood_hazard_layer_json.txt"
/>
What if we supported an optional legend
-ish attrs? E.g.
<Layer
title="FEMA National Flood Hazard Layer"
style=""
name="FEMA_FEMA_National_Flood_Hazard_Layer"
type="tiled_overlay"
agol="http://maps.massgis.state.ma.us/map_ol/fema_national_flood_hazard_layer_json.txt"
legend_img="http://massgis.maps.arcgis.com/sharing/rest/content/items/8455678914e64b03b565b97d07577279/info/thumbnail/fema_legend_200x133.png",
legend_href="http://massgis.maps.arcgis.com/home/item.html?id=8455678914e64b03b565b97d07577279"
/>
I do have control over those json files. I get them from the service, but I host a copy of them on the maps machine, so I can edit them. That sounds like a good plan.
@MassGIS According to http://resources.arcgis.com/en/help/rest/apiref/mslegend.html, it looks like /legend should do the trick.
Click on the legend link here http://server.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_Tapestry/MapServer and you get something.
But click on the legend link in MassGIS land here http://tiles.arcgis.com/tiles/hGdibHYSPO59RG1h/arcgis/rest/services/FEMA_National_Flood_Hazard_Layer/MapServer and you don't get the same kind of thing.
Is that something you can enable? If so I bet I can just follow the bouncing ball w/o any JSON or XML changes.
I think you stumbled upon a rare case where we published a vector layer with some dummy polygons just to have a legend. Most layers don't have that parallel mapservice offering the legend. Some raster layers won't be up in ArcGIS Online also. So I think the link to an image I craft and store on the maps.massgis.state.ma.us server is probably best. I should know what width/height would be good to use and I can make a sample one.
You want to pick a test JSON and modify it w/ a new legend img attr?
And if that doesn't work, we'll add it to a folderset.xml.
OK will do
OK, I made a legend for this layer and stored it at a new "legends" folder on maps: http://maps.massgis.state.ma.us/map_ol/legends/fema_national_flood_hazard_layer_legend.png You'll need to modify your copy of the json? Or should I make a copy of the json file on maps? Why do you need both legend_img and legend_href, wouldn't legend_img be enough?
Since these files, e.g. http://maps.massgis.state.ma.us/map_ol/fema_national_flood_hazard_layer_json.txt, live on your side, could you modify that one?
I was follownig the model in the description:
To display a legend for this layer, add <a href='http://massgis.maps.arcgis.com/home/item.html?id=8455678914e64b03b565b97d07577279' target='_blank'>http://massgis.maps.arcgis.com/home/item.html?id=8455678914e64b03b565b97d07577279</a> to your map along with this service"
If we just need an img, forget about the href.
That was a special case... so just stick with the one reference to the image URL and you should be fine.
Warming up to how to test things..
The problem with me modifying http://maps.massgis.state.ma.us/map_ol/fema_national_flood_hazard_layer_json.txt on my side is that is a live file that the live OLIVER is using - there is a reference to it from http://maps.massgis.state.ma.us/temp/oliver_folderset.xml
I think to test things I'm going to make a folder map_ol_2016 with any new OLIVER code, and have that point to a http://maps.massgis.state.ma.us/temp/oliver_folderset_2016.xml and that can point to a http://maps.massgis.state.ma.us/map_ol_2016/fema_national_flood_hazard_layer_json.txt
I modified the hosted copy of the JSON for the FEMA tiled service (but my test one): http://maps.massgis.state.ma.us/map_ol_2016/fema_national_flood_hazard_layer_json.txt I added this close to the top of the file:
"legend_img": "http://maps.massgis.state.ma.us/map_ol/legends/fema_national_flood_hazard_layer_legend.png"
http://maps.massgis.state.ma.us/map_ol_2016/legends contains all the legends but 1 or 2 that I'll need.
I've asked Michael Trust to help make one for elevation, and to consider if he wants one for Detailed Features. Otherwise, here is the list:
I modified the json files in map_ol_2016 as well:
http://maps.massgis.state.ma.us/map_ol_2016/czm_noaa_slr_combined_json.txt http://maps.massgis.state.ma.us/map_ol_2016/czm_noaa_slr_0_ft_json.txt http://maps.massgis.state.ma.us/map_ol_2016/czm_noaa_slr_1_ft_json.txt http://maps.massgis.state.ma.us/map_ol_2016/czm_noaa_slr_2_ft_json.txt http://maps.massgis.state.ma.us/map_ol_2016/czm_noaa_slr_3_ft_json.txt http://maps.massgis.state.ma.us/map_ol_2016/czm_noaa_slr_4_ft_json.txt http://maps.massgis.state.ma.us/map_ol_2016/czm_noaa_slr_5_ft_json.txt http://maps.massgis.state.ma.us/map_ol_2016/czm_noaa_slr_6_ft_json.txt
Thanks, this looks great. I'll see what kind of trouble I can get into down here.
The legend pngs are not a standard width, but I could make them that way if you want me to.
This looks like progress to me. It involved a few minor changes here in OLIVER and a lot of digging into the underlying GoeExt (ancient!) code. I need to figure out a good way to roll GeoExt into this repo.
Map
Printout
This looks great!
4/26 Aleda tested in http://maps.massgis.state.ma.us/map_ol_2016/oliver.php Seems to work. Other OLIVER functionality seems OK. Aleda will ask Emily to test and also try to add another legend to another layer.
I also got it to work with Hurricane Surge Inundation Zones. I have a few more layers I can set up now...
Original issue reported on code.google.com by
Aleda.Fr...@state.ma.us
on 17 Sep 2013 at 5:43