j256

Using Python to resymbolise polygon bandings from high to low

Discussion created by j256 on Nov 23, 2011
Latest reply on Feb 22, 2012 by GuyDuke
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

Outcomes