Select to view content in your preferred language

Automating the Symbology Layers based on their Classification using ArcPy

340
0
08-05-2024 11:56 AM
YahyaMasri
Emerging Contributor

Hello Everyone! 

I am working on automating the process of map making and I ran into an issue and was wondering if someone knows how to resolve it! So basically I am mapping points of interest from a CSV, and each point of data/interest has a specific category/classification assigned to it. Based on its category I want to map the point with a symbol matching the category. I already have each point of data assigned to a category in the CSV and I already have a Symbology Layer file saved to match each category for each category. I also have a dictionary setup and it looks like this: "

symbology_layers = {
"damage or destruction of buildings": "C:/Users/Yahya Masri/Desktop/automatic/layers/incidentLogCategoriesLxyr/damage_or_destruction_of_buildings.lyrx",
"deliberate targeting of noncombatants": "C:/Users/Yahya Masri/Desktop/automatic/layers/incidentLogCategoriesLxyr/deliberate_targeting_of_noncombattant.lyrx",
"forced disappearance": "C:/Users/Yahya Masri/Desktop/automatic/layers/incidentLogCategoriesLxyr/forced_disappearance.lyrx",
"indiscriminate use of weapons": "C:/Users/Yahya Masri/Desktop/automatic/layers/incidentLogCategoriesLxyr/indiscriminate_use_of_weapons.lyrx",
"military operations": "C:/Users/Yahya Masri/Desktop/automatic/layers/incidentLogCategoriesLxyr/miliary_operations.lyrx",
"unlawful detention": "C:/Users/Yahya Masri/Desktop/automatic/layers/incidentLogCategoriesLxyr/unlawful_detention.lyrx",
"willful killing of civilians": "C:/Users/Yahya Masri/Desktop/automatic/layers/incidentLogCategoriesLxyr/willful_killing_of_civilians.lyrx"
}

"

In short, the Key is the category which is assigned in the CSV and the Value is the path to the symbology layer. Usually, I have this line of code apply the symbology layer to all the points, but this can not be effective (arcpy.management.ApplySymbologyFromLayer(out_feature_class,'symbology_layer'). 

If anyone knows how to do this or reference me to where I can do this it would be greatly appreciated! 

0 Kudos
0 Replies