Using Python to resymbolise polygon bandings from high to low

351
3
11-23-2011 11:47 PM
JT2
by
New Contributor II
I am doing a choropleth/thematic batch mapping project, and need to alter the data classification (5 bands from low to high) on a map by map basis. That is, for each catchment on the map I need to:

- zoom to catchment
- reclassify the symbology based on the min and max polygon values within that catchment
- export map to pdf

My understanding is that Python doesn't provide access to symbology and data classification (eg Jenks, quantile etc). Will the following workaround function OK in Python? I'd welcome your thoughts:

1. Zoom to catchment
2. Set definition query to show only polygons in that catchment (based on predefined flag in attributes)
3. Loop through the rows of the visible polygons, note min and max values
4. Create 5 band categories (probably with equal interval since it's easiest to program)
5. For each category, create a selection of polygons within that category
6. Export that selection to a new shapefile (5 in total)
7. Resymbolise each exported shapefile according to predefined .lyr files (say from blue to red)
8. Job done

Will this work? Has anyone got experience using Python for this kind of job? I hope I've explained it clearly enough.

Thanks for your time
Tags (2)
0 Kudos
3 Replies
JT2
by
New Contributor II
It turns out my workaround above is not required. The job can be done with the "Apply Symbology From Layer (Data Management)" tool, more info here http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000006n000000

You just need to create a layer file beforehand, and then it updates your bandings (quantiles, equal interval etc) using the values contained in your data subset (via definition query).

Very handy indeed
0 Kudos
JeffBarrette
Esri Regular Contributor
You can also use arcpy.mapping.UpdateLayer.

At 10.1 we expanded the arcpy.mapping API to include symbology renderer properties (e.g., class breaks, labels, number of classes, etc.).

Jeff
0 Kudos
GuyDuke
New Contributor
Any chance this gets added as a service pack to 10.0?  I miss VBA...but we must move on with Python in the name of "progress"!
0 Kudos