#Specify output path and final output PDF outPath = r"C:MyProjectoutput\" finalPdf = arcpy.mapping.PDFDocumentCreate(outPath + "ParcelReport.pdf") #Specify the map document and the data frame mxd = arcpy.mapping.MapDocument(r"C:MyProjectMyParcelMap.mxd") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] #Select a parcel using the LocAddress attribute and zoom to selected parcelLayer = arcpy.mapping.ListLayers(mxd, "Parcels", df)[0] arcpy.SelectLayerByAttribute_management(parcelLayer, "NEW_SELECTION", "LocAddress" = '519 Main St') df.zoomToSelectedFeatures() #Turn on visibility for each theme and export the page lyrList = ["Soils", "Floodplains", "Zones"] for lyrName in lyrList: lyr = arcpy.mapping.ListLayers(mxd, lyrName, df)[0] lyr.visible = True #Export each theme to a temporary PDF and append to the final PDF tmpPdf = outPath + lyrName + "_temp.pdf" if os.path.exists(tmpPdf): os.remove(tmpPdf) arcpy.mapping.ExportToPDF(mxd, tmpPdf) finalPdf.appendPages(tmpPdf) #Turn off layer visibility and clean up for next pass through the loop lyr.visible = False del lyr, tmpPdf del mxd, df, finalPdf
lyrList = ["Soils", "Floodplains", "Zones"] for locaAddress in locAdresses: finalPdf = arcpy.mapping.PDFDocumentCreate(outPath + "ParcelReport "+locAddress+".pdf") arcpy.SelectLayerByAttribute_management(parcelLayer, "NEW_SELECTION", "LocAddress" = locAddress) df.zoomToSelectedFeatures() for lyrName in lyrList: lyr = arcpy.mapping.ListLayers(mxd, lyrName, df)[0] lyr.visible = True #Export each theme to a temporary PDF and append to the final PDF tmpPdf = outPath + lyrName + "_temp.pdf" if os.path.exists(tmpPdf): os.remove(tmpPdf) arcpy.mapping.ExportToPDF(mxd, tmpPdf) finalPdf.appendPages(tmpPdf) #Turn off layer visibility and clean up for next pass through the loop lyr.visible = False del lyr, tmpPdf
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.