Changes

Jump to navigation Jump to search
Open python window then:
#Load the map and create the dataframdataframe
mxd = arcpy.mapping.MapDocument(r"E:\projects\agglomeration\FullHullReview2017Colored.mxd")
df = arcpy.mapping.ListDataFrames(mxd)[0]
df.credits="(c) Ed Egan, 2019"
#Now do the image generation!
myDict = {}
#myDict["Burlington_VT"] = [-73.27691399999999,-73.176383,44.445927999999995,44.539927]
#... See the entries in E:\projects\agglomeration\arcpydict.txt
for location in myDict:
newExtent = df.extent
newExtent.XMin = myDict[location][0]
newExtent.XMax = myDict[location][1]
newExtent.YMin = myDict[location][2]
newExtent.YMax = myDict[location][3]
df.extent = newExtent
df.panToExtent(df.extent)
filename="E:\\projects\\agglomeration\\Images\\"+location +".png"
arcpy.mapping.ExportToPNG(mxd, filename, resolution=144)
#arcpy.RefreshActiveView()
#mxd.save()
 
If you run into issues, it's useful to test things step by step:
#Test some exports, note that if the geocords are in a different system from the extent parameters, you'll be exporting blank images!
arcpy.mapping.ExportToPNG(mxd, r"E:\projects\agglomeration\Images\BurlingtonAuto1.png", resolution=144)
df.panToExtent(df.extent)
arcpy.mapping.ExportToPNG(mxd, r"E:\projects\agglomeration\Images\BuffaloAuto2.png", resolution=144)
#Now do the image generation!
myDict = {}
#myDict["Burlington_VT"] = [-73.27691399999999,-73.176383,44.445927999999995,44.539927]
#... See the entries in E:\projects\agglomeration\arcpydict.txt
for location in myDict:
newExtent = df.extent
newExtent.XMin = myDict[location][0]
newExtent.XMax = myDict[location][1]
newExtent.YMin = myDict[location][2]
newExtent.YMax = myDict[location][3]
df.extent = newExtent
df.panToExtent(df.extent)
filename="E:\\projects\\agglomeration\\Images\\"+location +".png"
arcpy.mapping.ExportToPNG(mxd, filename, resolution=144)
#arcpy.RefreshActiveView()
#mxd.save()
Remove basemap credits[https://community.esri.com/thread/185775-remove-service-layer-credits]:

Navigation menu