Quantcast
Channel: Question and Answer » arcpy
Viewing all articles
Browse latest Browse all 767

Exporting multiple map pages from list of apns

$
0
0

I use the code below to export two maps with different layers active for a single apn. The problem is I have a large list of APNs to go through so plugging in each apn at a time isn’t really feasible. I would also need each map saved as the apn. I don’t really now the best way to go about this.

mxd = arcpy.mapping.MapDocument('CURRENT')
df = arcpy.mapping.ListDataFrames(mxd, '')[0]
arcpy.SelectLayerByAttribute_management ("Parcels", "NEW_SELECTION", " "APN" ='42013306' ")
df.zoomToSelectedFeatures()
df.scale = 12000 # 1:15,000
arcpy.RefreshActiveView()

df = arcpy.mapping.ListDataFrames(mxd, '')[0]
allLayers = arcpy.GetParameterAsText(1)
lyrList = allLayers.split(";")

    for lyr in arcpy.mapping.ListLayers(mxd, '', df):

    for layer in lyrList:
        if lyr.name == "Map Page 1":
            lyr.visible = True

arcpy.mapping.ExportToPNG(mxd, r"C:Arc Map 2013CA Arc Map DataArcMap MapsMap1 Test.PNG")

for lyr in arcpy.mapping.ListLayers(mxd, '', df):

    for layer in lyrList:
        if lyr.name == "Map Page 1":
            lyr.visible = False
for lyr in arcpy.mapping.ListLayers(mxd, '', df):

    for layer in lyrList:
        if lyr.name == "Map Page 2":
            lyr.visible = True
arcpy.mapping.ExportToPNG(mxd, r"C:Arc Map 2013CA Arc Map DataArcMap MapsMap2 Test.PNG")
del mxd

Viewing all articles
Browse latest Browse all 767

Trending Articles