Select to view content in your preferred language

Is there a way to alter symbology size using arcpy?

3014
5
08-01-2016 02:27 PM
DavidLa_France
Deactivated User

I am creating a GeoPDF using TerraGo.  Point symbologies scale nicely when zooming within ArcMap, but once I export to GeoPDF the size of a point symbology relative to the underlying raster becomes fixed.  As I zoom within Adobe Acrobat Reader, the point symbol becomes bigger and bigger.

I can counter this by replicating the point layer once per PDF zoom level (e.g. 100%, 125%, 150%, etc.) and making each layer visible only at the appropriate range.  I then set the pixel size for each layer (e.g. 10, 8, 6.67, etc.)  This works great when I do everything in ArcMap.  However, I would like to script this using arcpy.  I can replicate the layer and set the scale range using arcpy, but I would like to also set the symbology size so that the whole process could be automated.

As a workaround, I can create and save a set of layers by hand, then use a script to copy their symbologies into my new layers.  I would need to do this for each style (shape, color, classification, etc.) I intend to use.  With the wide variety of options available, especially for color ramps, this approach is severely limiting.  All I really need to do is change the pixel size of an existing layer.

Is there a way to do this?

0 Kudos
5 Replies
DanPatterson_Retired
MVP Emeritus

I see nothing in arcpy itsef nor in the arcpy mapping module...but here is the link

What is ArcPy?—Help | ArcGIS for Desktop

0 Kudos
FC_Basson
MVP Regular Contributor

Extract from Layer—Help | ArcGIS for Desktop

Depending on the symbology type, a layer's symbology can be modified. There are a limited number of supported symbology types for which properties and methods are available. It is good practice to first test the layer's symbologyTypeproperty. If a value of OTHER is returned, then the layer's symbology can't be modified. If the value returned is not OTHER, then the layer's symbology property will return one of the following symbology classes, each with their own unique set of methods and properties: GraduatedColorsSymbology, GraduatedSymbolsSymbology, RasterClassifiedSymbology, andUniqueValuesSymbology.

DavidLa_France
Deactivated User

Thanks.  This does allow me to get at some of the attributes, allowing more flexibility in the choices of symbolgy.  I still have the problem with size, since none of these allow me to change that.  I've seen plenty of postings indicating this is intentionally not supported, so I guess I have to live with this. (See "line in the sand" comments in Managing Symbology using Python )

0 Kudos
DanPatterson_Retired
MVP Emeritus

perhaps as the python winds pick up, you might see some access through arcpy... so keep a bookmark on that link I sent and perhaps one for PRO ArcGIS Pro ArcPy Reference—ArcGIS Pro | ArcGIS for Desktop

0 Kudos
DavidLa_France
Deactivated User

I have successfully used arcpy.mapping.UpdateLayer to copy symbology from a layer file.  The destination layer gets its color and size from the layer file as expected.  However, if I update the classBreakValues as in the example at the bottom of desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-mapping/graduatedcolorssymbology-class.htm, the destination layer is set to a green circle of size 4.  Am I missing something?

I am not exporting to PDF at this point.

0 Kudos