Monday 27 June 2016

arcgis desktop - Adding labels with symbols to legend in ArcMap?


I'm creating a map with ArcGIS Desktop v10.2.2, showing museums as points. The museums layer has no symbol and the labels are made of a circle filled with color with the ID inside, taken from the [ID] field.


I want to add the entire list of museums in the layout map legend, having a list of my symbols with their IDs and the description (their name) taken from the [LABEL] field, without creating it manually.


I know that a possible manual solution would be to set the layer symbology to "Unique values", then add all values (more than 100!) and set once for each point the same label symbology. But I hope there's a better solution!



Take a look at my map below.


The layer is "Musei" (Museums) and as you can see on the legend on the left, it has no symbol. On the right you can see the descripted legend symbology, a Dark gray circle with Red text inside taken from the [ID] field. I want to add to my layout a column containing all the circles with IDs and the corresponding label.


Museums


-- UPDATE --


This is the Field Calculator settings I used following the solution proposed by @FelixIP.


Field Calculator


But the points are not positioned in vertical align as I expect. Instead they're moved a bit here and there. I also tried using different step values: 10, 100, 1000, 10000.



Answer



To get this:


enter image description here



I've used 2 dataframes:


enter image description here


STEPS:


a) Create a copy of your museums shapefile; b)Note xMean, yMax of the points and c) Run this field calculator expression multiple times changing step on Shape field until you happy with interval between vertical points


def vertical(fid, shp,xMean,yMax,step):
y=yMax-step*fid
pNew=arcpy.Point(xMean,y)
return pNew

Using



vertical( !FID!, !Shape!, 1563910,5177655,100)

It will create vertical chain of your points to be displayed and labelled in 2nd dataframe === legend


Update: average longitude of the points i used is 1563910, maximum longitude 5177655


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...