Widen ArcGIS Online legend patches so dashed patterns fit

04-11-2014 01:59 PM
Status: Open
Occasional Contributor
In ArcGIS Online, dashed patterns are not represented in the legend because the patches are not wide enough to show the pattern. This happens with both feature layers and tiled layers. If I publish a tile package from ArcGIS Desktop the legend patch is always 20px wide no matter how wide I made my legend patch in desktop. I used the Advanced ArcMap Settings utility to make wider legend patches in Desktop, but they don't translate to AGOL.
In case anyone is looking for a workaround, here's what I do to get around this.
  • Create the custom legend or symbol in a graphics application like Illustrator and save as PNG.
  • Create an empty feature class and add it to your MXD.
  • Assign symbology of the empty feature class to the custom PNG graphic.
  • Publish map as tile package.
  • Base64 encode the custom legend PNG with a site like this: http://base64.wutils.com/encoding-online/image-to-base64/
  • Open the tile package contents with 7zip without actually unzipping (if you unzip to edit, you have to re-zip in a specific way – I believe without compression – or the tile package won’t work in AGOL).
    • Navigate to here: \servicedescriptions\mapserver\
    • Edit the mapserver.json file:
    • Find the legend item and update the following with your new image data
      • "imageData":"" (in between the quotes will go your Base64 text string)
      • Edit the "height" and "width" properties to match the custom graphic’s dimensions.
    • If you’re re-publishing an existing tile package, you’ll also have to update the "url": property with a new guid because I think AGOL stores each image as an object in AGOL that it just references.
  • Upload this edited tile package to AGOL and add it to the web map.
by Anonymous User

To provide an example...Capture A will display in the legend as just a line while Capture B will display the triangle marker symbol and looks like this . This was accomplished by moving the starting point of the marker line symbol to the beginning of the line.

Capture A:

screen capture of symbology used that does not display in the legend correctly

Capture B:

Moved the starting point of the marker symbol to the beginning of the line and this allows the triangle marker to be displayed in the AGO legend