Home
All Communities
Products
Developers
Industries
Global Communities
Services & Learning
Networks
Esri Events
ArcGIS Topics
User Groups
Events
ArcGIS Ideas
Community Resources
Community Blog
Community Feedback
Community Help
Member Introductions
MVP Program
Discussions
Help
Home
Developers
Developers - General
Legend swatch images for Cached Map Service should be pre-generated and saved under cache folder
HieuHo
Currently, at 10.0 SP1, support for a
Map Service Legend
child resource was added. Map legend can be request via ArcGIS Server REST API using the syntax like this
http://services.arcgisonline.com/ArcGIS/SDK/REST/mapserver.html"
DK/REST/mapserver.html" target="_blank">
<mapservice-url>
/legend
Legend swatch image for each layer can be accessed directly using the URL syntax
http://<mapservice-url>/<layerId1>/images/<imageUrl11
>
However, when a legend request is sent to the Server, the server will query the map document (MXD or MSD) to generate the Legend image. This should be no problem for dynamic service and regular cached map services such as
Dynamic service:
http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Louisville/LOJIC_LandRecords_Louisville/MapServer/legend
Cached service:
http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/PublicSafety/PublicSafetyBasemap/MapServer/legend
However, after the cache is created, the best practice for maintaining cached services is to remove some or all of the laters from the source map docuemnt, leaving just one simple or dummy layer in the map document to maintain the coordinate system and extent as discussed
here
.
This will be a problem for ArcGIS Online services hosted on ArcGIS.com because legend response will be blank like this
http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/legend
http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer/legend
My idea is once the cache is generated, the associated legend image and/or swatches should be created and saved in the same cache folder (same as conf.xml file) for example c:\arcgisserver\arcgiscache\<Map_Service_Name>\Layers\ The rest handler should be able to process the legend request and go to arcgiscache folder to retrieve the legend swatches/images.
This way, when layers are removed from the source map document, legend is still working for these cached map services.
Find more posts tagged with
Status: Open
Comments
HieuHo
Yes, map legend is very important to maps. Without legend, maps might be misleading or not helpful as they should be.
Join the Conversation
Sign in to post, follow content, and more. New here? Register for free.
Sign In
Register
Quick Links
All Communities
Recent Posts
User Groups
Followed Content
Community Help