USGS-WiM / WLERA

Western Lake Erie Restoration Assessment
http://glcwra.wim.usgs.gov/WLERA/
Other
2 stars 5 forks source link

Fix legend label for selected parcels #43

Closed BlakeDraper closed 8 years ago

BlakeDraper commented 9 years ago

Need to intercept the Web_Map_as_JSON data and parse. Insert a proper label for operationalLayers[5].featureCollection.layers[0].layerDefinition.drawingInfo.renderer.label. Currently is a blank causing the default label of "Override 1"

See: https://geonet.esri.com/thread/100664

and this, for intercepting the JSON: http://gis.stackexchange.com/questions/130362/how-to-customize-the-arcgis-print-legend-text-using-javascript

BlakeDraper commented 9 years ago

Tried the method from link # 1, and did sucessfully inject label name to the Web_Map_as_JSON, but it still prints "Override 1" for the label. Darn.

Yerp. This geonet thread may indicate that this is a bug, and not yet fixed by esri: https://geonet.esri.com/thread/101287

njestes commented 9 years ago

Can you set it on the layer in the mapper (looks like maybe on the renderer) rather than having to intercept and parse the Web_Map_as_JSON? Might be less of a headache.

BlakeDraper commented 9 years ago

The interception was actually pretty easy, but still doesn't work. See my above comment, which I was probably typing while you were making yours.

njestes commented 9 years ago

Yeah. I'm thinking the other way might work though. Fodder for dev call?

BlakeDraper commented 9 years ago

Decided to just not show the parcels layer in the legend, but can't get it to go away, even following the API docs. I thought for a moment this might hold the answer: http://gis.stackexchange.com/questions/116865/no-legend-showing-at-all-in-arcgis-server-print-task-mapexport

And it does point something out that I didn't know and that the docs don't make clear, but I was already calling the correct ID anyway. It really seems like the server is not respecting the legendLayers property.

BlakeDraper commented 9 years ago

Nailed it. Typo. Had "legendlayers": [legendLayer] instead of "legendLayers": [legendLayer] (needed to camelCase it). The improperly typed property was failing silently and the PrintTask was acting as if a blank array was provided, which is to display legend for all operational layers. Now I have just the one I want displaying.