I have some ArcMap addin that creates new layer and add it into table of content. I need to set up labels for that layer.
I have made some script for labeling layer:
mxd = arcpy.mapping.MapDocument("CURRENT")
data_frame = mxd.activeDataFrame
layer_divide = arcpy.mapping.ListLayers(mxd, "layer", data_frame)[0]
if layer_divide.supports("LABELCLASSES"):
for lblclass in layer_divide.labelClasses:
lblclass.expression = "[OBJECTID]"
lblclass.showClassLabels = True
layer_divide.showLabels = True
arcpy.RefreshActiveView()
This add labels, but I don't know how to change font size of that labels.
1 Answer 1
Labels in ArcMap can have formatting codes within the expression, so something like:
lblclass.expression = '"{}" + [OBJECTID] + "{}"'.format("<FNT size = '24'>","</FNT>")
might work for you. This is adding font tags around your ObjectID into a label expression <FNT size = '24'> + OBJECTID + </FNT>
-
Thank you! That expression worked for font size. What about layer symbology? Don't you know hot to set it?david_p– david_p2016年02月02日 08:59:34 +00:00Commented Feb 2, 2016 at 8:59
-
1Sorry I didn't see you had two questions - please ask this as a separate question.2016年02月02日 17:46:44 +00:00Commented Feb 2, 2016 at 17:46
-
OK, I ask new question here: gis.stackexchange.com/questions/179139/…david_p– david_p2016年02月02日 19:59:55 +00:00Commented Feb 2, 2016 at 19:59
Explore related questions
See similar questions with these tags.