2

I have a very simple shapefile to which I join a bunch of fields. I then need to have these new fields symbolized with a specific color ramp using a five quantile classification and then exported to a JPG at a certain resolution with a specific filename.

Is it possible to sort of "preload" the software manually with the layers and page layout I want and then have it loop in such a way that it merely changes the symbology field value and exports, over and over?

There is a legend but since the labels will remain the same (quantile 1, quantile 2, etc) I can just leave that as a hardcoded graphic.

I'm envisioning something like this: I add my two layers (one is a fill-free layer of US states to serve as an outline for the other layer) and then join one big file to the layer that needs symbology. This program I don't know how to write would then loop through and change the symbology field value to the next column I've added, and changes the classification back to a 5-class quantile (it always reverts to Jenks for some reason). Then since the legend is hardcoded it just needs to save this new map of field Beta1 as a jpg and then switch to Beta2, Beta3, etc.

2
  • It is possible to update the legends of the maps representing different fields, as arcmap allows to update the legend of an existing layer. See this link resources.arcgis.com/en/help/main/10.1/index.html#/…
    – osmarllq
    Commented Jul 2, 2014 at 23:21
  • This doesn't really answer the question though. Asker isn't seeking to update a legend, he's trying to apply a standard symbology to geometry using many different fields iteratively.
    – Chris W
    Commented Jul 3, 2014 at 0:03

1 Answer 1

3

The ArcMap interface resets the symbology classification to jenks whenever you change the symbology layer, which is kind of annoying. I've gotten around this to make batches of 100s of maps using ArcPython.

First, set the symbology to run off of a field in the attribute table called "temp" or something like that. Tweak the symbology to your liking. Then you will iteratively replace that values of that field using Field Calculator, then export the map:

import arcpy

#List of names of fields to be mapped
ListOfFieldsToSymbolize = ["field1","field2","field3"]

#Temporary field that layer is currently using in ArcMap
SymbolizedField = "temp"

for Field in ListOfFieldsToSymbolize:

    #Replace temporary field with one of the fields to be mapped
    arcpy.CalculateField_management("Layer", SymbolizedField, "!" + Field + "!", "PYTHON")    

    arcpy.mapping.ExportToPDF(Current.mxd, Output.pdf)
7
  • THANKS! This is working wonders. I got a bit hung up because it didn't understand what Current meant in the export, but I added an mxd= line to the top and that fixed it. Do you know how to tell it which folder I want to export the PDFs to? I'm not sure how it chose the folder it did (maybe because the MXD file is saved there) but I would like to be able to tell it to save somewhere else.
    – Jacob
    Commented Mar 21, 2012 at 13:14
  • Wait no sorry this doesn't work. It keeps the same break values for each of the fields. I need it to recalculate the appropriate breakpoints based on the new field that cycles through. Is this possible?
    – Jacob
    Commented Mar 21, 2012 at 13:49
  • @Jacob As far as I know this is not possible. ArcMap symbology can only be "edited" with ArcPython by importing pre-made .lyr files. The workaround for this that I've used in the past is to use Excel to determine which bin each feature of each map should be in, and symbolize based off of these bin numbers. The issue with this is that the legend values will not update. To get around this, you can convert the legend to graphics and use ArcPy to update the text elements. However, this much work is probably only worth it if you're doing lots of maps in your batch.
    – dmahr
    Commented Mar 21, 2012 at 17:32
  • Ahh, clever. I like that approach. The legend doesn't matter since it just says "lowest quintile" and "highest quintile" (we're not divulging actual numbers). Now I just need to figure out how to get it to export the PDF to a certain folder and I'll be golden.
    – Jacob
    Commented Mar 22, 2012 at 13:08
  • @Jacob You can just specify the output path in the arcpy.mapping.ExportToPDF() command.
    – dmahr
    Commented Mar 22, 2012 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.