I have a feature class of points that represent storm water inlets. I am trying to automate a process that does the following.

  1. finds all of the inlets that have a field called "Marker" populated with the string "No"
  2. generate a PDF for each of these features that is a centered view at 1:50 scale.

I'm pretty new to Python. I've been working on this for awhile and keep getting an output of a single PDF (not 800, which is the aprox. # of inlets with "No") and the ArcMap crashes as the script is finishing. I'm sure my code is pretty whack!

enter image description here

  • This is an old question but, as I am confident you now know, questions about code should always have that presented as text rather than a picture. – PolyGeo Dec 21 '17 at 23:03

I would use the "SHAPE@" token with the search cursor, then do something like this:

with arcpy.da.SearchCursor(fc, ("SHAPE@", "UNIQUE_ID")) as searchCur:
    for row in searchCur:
            myDF.extent = row[0].extent
            myDF.scale = 50
                r"N:\27000s\27800\GIS\John_Working\PDF\Map_" + str(row[1]) + ".pdf", 
                 resolution=100, image_quality="Normal")
  • Thanks! this works perfectly! If you don't mind... Could you elaborate on what I was doing wrong, why is the SHAPE@ token necessary? – GeoJohn Oct 3 '14 at 15:08
  • 1
    If you are using Search Cursor DA, you do not need to also Select the features. The cursor will go to every row in the "for row in searchCur" loop. The SHAPE@ token returns the geometry of the object, so you can grab that extent and set it as the data frame extent (myDF.extent = row[0].extent), then set the scale, refresh and export the pdf. – detroit_hc Oct 3 '14 at 15:15
  • That makes a great deal of sense. Thank you for the explanation! – GeoJohn Oct 3 '14 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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