ArcPro 2.3.3 ArcPy listColorRamps and .stylx help needed?

386
0
09-24-2020 10:43 AM
JohnMossing
New Contributor II

ArcPro 2.3.3. Have a detailed work flow and numerous tools scripted in a .pyt tool box handling our GIS workflow and automating project, layout, and map creation, including automagically symbolizing layers. Having trouble with and I do not know how to reference a custom color ramp saved in a .stylx file which can be accessed by all users off a share drive.

This is the code that I have:

#Set Symbology for binning layers
if lyr.name == "Binning Analysis"
sym = lyr.symbology
sym.updateRenderer('GraduatedColorsRenderer')
sym.renderer.colorRamp = aprx.listColorRamps('Custom-Blues')[0]
sym.renderer.classificationMethod = 'EqualInterval'
sym.renderer.classificationField = "Field"
classBreakValues = [5, 15, 35, 60, 1000]
classBreakLabels = ["1 - 5", "6 - 15", "16 - 35", "36 - 60", "> 60"]
sym.renderer.breakCount = len(classBreakValues)
count = 0
for brk in sym.renderer.classBreaks:
brk.upperBound = classBreakValues[count]
brk.label = classBreakLabels[count]
brk.symbol.outlineColor = {'RGB' : [255, 255, 255, 0]}
count += 1
lyr.symbology = sym

Specifically having problems with this line: aprx.listColorRamps('Custom-Blues')[0]

This line ONLY seems capable of referencing from a stylx called "Favorites.stylx" found in the USERS %appdata%\ESRI\ArcGISPro directory. Meaning only if the color ramp is saved in that users Favorites.stylx file will it find it and work. Otherwise it gives an error index out of range because it cannot find it. 

I do not want to code or deal with individual users Favorites.stylx files. Because users cannot access other users files, and I cannot update every single users Favorites.stylx file with the "Team's" custom color ramps.

Is it possible, and can I reference aprx.listColorRamps('Custom-Blues')[0] to another .stylx file located on a share drive accessible by all users? If so how do I do that?

I have tried various combos of: aprx.listColorRamps(r'H:\Path\Path\Whatever\Team.stylx\Custom-Blues')[0] and it fails. No matter how I try to reference it to another .stylx file it fails.

Any assistance would be appreciated. Thank you.

John

0 Kudos
0 Replies