Who Loves the Python CIM (Cartographic Information Model) Access?

04-08-2024 10:12 AM
Occasional Contributor III

Seems Python CIM Access is a continuation of potentially productive Python automation in the ArcGIS workflow that will eventually flame out because the API design failed to abstract xml hierarchical file manipulation into classes, methods, and attributes that were generalized coherently.  Look no further than these highly ranked Stack Exchange GIS Pros who essentially advise those interested in the FieldMapping classes to...brute force it ( Field Mapping Alternatives ).

The last line is my Case In Point.  Accessing symbology on layers symbolized by unique values should not involve drilling down 7 times; particularly symbol.symbol

import copy
p = arcpy.mp.ArcGISProject('current')
m = p.listMaps('Map')[0]
l = m.listLayers('COS_basin_minor_2024')[0]
cim_lyr = l.getDefinition('V3')
# Change or View Colors
>>> [348, 29, 99, 100]

Screenshot 2024-04-08 104826.png

If anybody has advice on taming the CIM from a productivity and reproducibility standpoint, I'd love to hear YOUR successful applications.  It seems accessing attributes like symbology, labels, etc. vary based on whether there is a color ramp applied, symbology from field values, and of course no continuity between rasters and vectors.  Very reminiscent of the difficulty in manipulating Field Mappings i.e. merging data.  

More to be Desired,



Tags (2)
1 Reply
Occasional Contributor III

I was having an otherwise good day until you mentioned accursed Field Mappings.

0 Kudos