import arcpy mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd)[0] #Change the [number] to whichever dataframe you want to use (0 is the first dataframe, 1 in the second, etc.) rows = arcpy.SearchCursor(pointsLyr.dataSource) cols = arcpy.ListFields(pointsLyr.dataSource) for row in rows: for col in cols: if col.name == "LATITUDE": latstr = row.getValue(col.name) if col.name == "LONGITUDE": lonstr = row.getValue(col.name) if col.name == "OBJECTID": objstr = str(row.getValue(col.name)) arcpy.SelectLayerByAttribute_management(pointsLyr.dataSource,"NEW_SELECTION", ("%s = %s" % (col.name, objstr) newextent = df.extent xmin = float(lonstr) - .005 ymin = float(latstr) - .005 xmax = float(lonstr) + .005 ymax = float(latstr) + .005 newextent.XMin, newextent.YMin newextent.XMax newextent.YMax = xmin, ymin, xmax, ymax df.extent = newextent df.panToExtent(df.extent) arcpy.RefreshActiveView()
import arcpy mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd)[0] #Change the [number] to whichever dataframe you want to use (0 is the first dataframe, 1 in the second, etc.) for lyr in arcpy.mapping.ListLayers(mxd): if lyr.name=="Points": #Change to the name of the point layer in your table of contents pointsLyr=lyr break #this will only get the first occurance of the given name in the TOC rows = arcpy.SearchCursor(pointsLyr.dataSource) for row in rows: arcpy.SelectLayerByAttribute_management(pointsLyr, "NEW_SELECTION", '"FID" = '+str(row.FID)) df.zoomToSelectedFeatures() arcpy.SelectLayerByAttribute_management(pointsLyr, "CLEAR_SELECTION") #clears selected so that the exported PDF does not have that selected blue colouring df.scale=50000 #set scale as desired. If there is an attribute for scale use this: df.scale=row.Scale arcpy.RefreshActiveView() arcpy.RefreshTOC() arcpy.mapping.ExportToPDF(mxd, "C:\\Users\\jchishol\\Desktop\\TEMPzoompoint\\Output"+str(row.FID)+".pdf") #exports to PDFs. The files have the 'row.FID' in them so they do not all have the same name del mxd,df,lyr,pointsLyr,row,rows
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.