Is This Content Helpful?
We're glad to know this article was helpful.
Why are legends missing when publishing a tile package to ArcGIS Online?
When using the geoprocessing tools in the Tile Cache toolset to generate a tile cache, map elements, such as the legend, are not preserved in the published tile service. This is expected behavior. The method used for building the tile cache when working in ArcMap affects whether elements of the map are preserved when publishing the tile cache, including legends.
Users can share a tile package (.tpk) file on ArcGIS Online and choose to publish it as a hosted tile layer. Two different workflows are described in the following ArcGIS Online help page, Publish tiles. The first is used for small to moderately sized tile packages, and preserves elements of the map document, such as the legend and text elements, when the tiles are published from the tile package. Whereas, the second workflow is recommended when publishing large tile packages, but maintains only the data when tiles are published from the tile package.
ArcGIS Runtime SDK users may also build legends from a tiled package in code. Refer to the following page, the AGSLocalTiledSubLayerInfo, for more details. It is possible to build a legend for the local tiled layer as the AGSLocalTiledSubLayerInfo class reference has the legendImages and legendLabels properties.