#!/arcgisserver/arcgis/server/tools/python # # arcpy.GetParameterAsText(0): Kompletter Pfad der MXD # arcpy.GetParameterAsText(1): Ausgabepfad fuer die Bilder # arcpy.GetParameterAsText(2): Praefix fuer die Ausgabedatei, Nummerierung kommt aus Kartenserien-Konfiguration, Dateiendung wird angehaengt # arcpy.GetParameterAsText(3): Debug-Flag import arcpy mxd = arcpy.mapping.MapDocument(arcpy.GetParameterAsText(0)) print arcpy.GetParameterAsText(0) debugOn = arcpy.GetParameterAsText(3) outPath = arcpy.GetParameterAsText(1) outPrefix = arcpy.GetParameterAsText(2) def getOutputName(prefix): result = prefix + str(ddp.pageRow.getValue(ddp.pageNameField.name)) + ".png" return result print "Start exporting %s PNGs" % (mxd.dataDrivenPages.pageCount) maxRange = mxd.dataDrivenPages.pageCount + 1 if (debugOn == "1"): for lyr in arcpy.mapping.ListLayers(mxd): #get the source from the layer if lyr.supports("workspacePath"): source = lyr.workspacePath print "%s -> %s" % (lyr, source) maxRange = 15 for pageNum in range(1, maxRange): if (debugOn == "1"): print "Page %s" % (pageNum) mxd.dataDrivenPages.currentPageID = pageNum ddp = mxd.dataDrivenPages if (debugOn == "1"): print "Exporting page {0} of {1}".format(str(mxd.dataDrivenPages.currentPageID), str(maxRange)) outputName = getOutputName(outPrefix) print str(outPath) + "/" + str(outputName) arcpy.mapping.ExportToPNG(mxd, str(outPath) + "/" + str(outputName), resolution=150)
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.