Skip to main content
code formatting
Source Link
Midavalo
  • 29.9k
  • 11
  • 51
  • 105

I have a script that works to export my pages as jpegs, but I want to add the world file to them. I don't want to have to do all the {df} args and whatnot, I just want to skip to the world file. How can I do this?

Script I currently have:

mxd = arcpy.mapping.MapDocument("CURRENT")
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
    mxd.dataDrivenPages.currentPageID = pageNum
    arcpy.mapping.ExportToJPEG(mxd, r"D:\Matt_work\jpgs" + str(pageNum) + ".jpg")
del mxd

EDIT: If I use this script: mxd = arcpy.mapping.MapDocument("CURRENT") ... for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1): ... mxd.dataDrivenPages.currentPageID = pageNum ... arcpy.mapping.ExportToJPEG(mxd, r"D:\Matt_work" + str(pageNum) + ".jpg", world_file=True) ... del mxd ...

mxd = arcpy.mapping.MapDocument("CURRENT") 
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
    mxd.dataDrivenPages.currentPageID = pageNum
    arcpy.mapping.ExportToJPEG(mxd, r"D:\Matt_work" + str(pageNum) + ".jpg", world_file=True)
del mxd

I get this runtime error:

Runtime error Traceback (most recent call last): File "", line 4, in File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\utils.py", line 182, in fn_ return fn(*args, **kw) File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\mapping.py", line 1026, in ExportToJPEG layout.exportToJPEG(*args) File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\utils.py", line 182, in fn_ return fn(*args, **kw) File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\arcobjects\mixins.py", line 568, in exportToJPEG return self._arc_object.exportToJPEG(*args) TypeError: PageLayoutObject: Error in executing ExportToJPEG

Runtime error 
Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\utils.py", line 182, in fn_
    return fn(*args, **kw)
  File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\mapping.py", line 1026, in ExportToJPEG
    layout.exportToJPEG(*args)
  File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\utils.py", line 182, in fn_
    return fn(*args, **kw)
  File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\arcobjects\mixins.py", line 568, in exportToJPEG
    return self._arc_object.exportToJPEG(*args)
TypeError: PageLayoutObject: Error in executing ExportToJPEG

I have a script that works to export my pages as jpegs, but I want to add the world file to them. I don't want to have to do all the {df} args and whatnot, I just want to skip to the world file. How can I do this?

Script I currently have:

mxd = arcpy.mapping.MapDocument("CURRENT")
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
    mxd.dataDrivenPages.currentPageID = pageNum
    arcpy.mapping.ExportToJPEG(mxd, r"D:\Matt_work\jpgs" + str(pageNum) + ".jpg")
del mxd

EDIT: If I use this script: mxd = arcpy.mapping.MapDocument("CURRENT") ... for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1): ... mxd.dataDrivenPages.currentPageID = pageNum ... arcpy.mapping.ExportToJPEG(mxd, r"D:\Matt_work" + str(pageNum) + ".jpg", world_file=True) ... del mxd ...

I get this runtime error:

Runtime error Traceback (most recent call last): File "", line 4, in File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\utils.py", line 182, in fn_ return fn(*args, **kw) File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\mapping.py", line 1026, in ExportToJPEG layout.exportToJPEG(*args) File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\utils.py", line 182, in fn_ return fn(*args, **kw) File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\arcobjects\mixins.py", line 568, in exportToJPEG return self._arc_object.exportToJPEG(*args) TypeError: PageLayoutObject: Error in executing ExportToJPEG

I have a script that works to export my pages as jpegs, but I want to add the world file to them. I don't want to have to do all the {df} args and whatnot, I just want to skip to the world file. How can I do this?

Script I currently have:

mxd = arcpy.mapping.MapDocument("CURRENT")
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
    mxd.dataDrivenPages.currentPageID = pageNum
    arcpy.mapping.ExportToJPEG(mxd, r"D:\Matt_work\jpgs" + str(pageNum) + ".jpg")
del mxd

EDIT: If I use this script:

mxd = arcpy.mapping.MapDocument("CURRENT") 
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
    mxd.dataDrivenPages.currentPageID = pageNum
    arcpy.mapping.ExportToJPEG(mxd, r"D:\Matt_work" + str(pageNum) + ".jpg", world_file=True)
del mxd

I get this runtime error:

Runtime error 
Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\utils.py", line 182, in fn_
    return fn(*args, **kw)
  File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\mapping.py", line 1026, in ExportToJPEG
    layout.exportToJPEG(*args)
  File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\utils.py", line 182, in fn_
    return fn(*args, **kw)
  File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\arcobjects\mixins.py", line 568, in exportToJPEG
    return self._arc_object.exportToJPEG(*args)
TypeError: PageLayoutObject: Error in executing ExportToJPEG
added 1033 characters in body
Source Link

I have a script that works to export my pages as jpegs, but I want to add the world file to them. I don't want to have to do all the {df} args and whatnot, I just want to skip to the world file. How can I do this?

Script I currently have:

mxd = arcpy.mapping.MapDocument("CURRENT")
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
    mxd.dataDrivenPages.currentPageID = pageNum
    arcpy.mapping.ExportToJPEG(mxd, r"D:\Matt_work\jpgs" + str(pageNum) + ".jpg")
del mxd

EDIT: If I use this script: mxd = arcpy.mapping.MapDocument("CURRENT") ... for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1): ... mxd.dataDrivenPages.currentPageID = pageNum ... arcpy.mapping.ExportToJPEG(mxd, r"D:\Matt_work" + str(pageNum) + ".jpg", world_file=True) ... del mxd ...

I get this runtime error:

Runtime error Traceback (most recent call last): File "", line 4, in File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\utils.py", line 182, in fn_ return fn(*args, **kw) File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\mapping.py", line 1026, in ExportToJPEG layout.exportToJPEG(*args) File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\utils.py", line 182, in fn_ return fn(*args, **kw) File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\arcobjects\mixins.py", line 568, in exportToJPEG return self._arc_object.exportToJPEG(*args) TypeError: PageLayoutObject: Error in executing ExportToJPEG

I have a script that works to export my pages as jpegs, but I want to add the world file to them. I don't want to have to do all the {df} args and whatnot, I just want to skip to the world file. How can I do this?

Script I currently have:

mxd = arcpy.mapping.MapDocument("CURRENT")
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
    mxd.dataDrivenPages.currentPageID = pageNum
    arcpy.mapping.ExportToJPEG(mxd, r"D:\Matt_work\jpgs" + str(pageNum) + ".jpg")
del mxd

I have a script that works to export my pages as jpegs, but I want to add the world file to them. I don't want to have to do all the {df} args and whatnot, I just want to skip to the world file. How can I do this?

Script I currently have:

mxd = arcpy.mapping.MapDocument("CURRENT")
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
    mxd.dataDrivenPages.currentPageID = pageNum
    arcpy.mapping.ExportToJPEG(mxd, r"D:\Matt_work\jpgs" + str(pageNum) + ".jpg")
del mxd

EDIT: If I use this script: mxd = arcpy.mapping.MapDocument("CURRENT") ... for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1): ... mxd.dataDrivenPages.currentPageID = pageNum ... arcpy.mapping.ExportToJPEG(mxd, r"D:\Matt_work" + str(pageNum) + ".jpg", world_file=True) ... del mxd ...

I get this runtime error:

Runtime error Traceback (most recent call last): File "", line 4, in File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\utils.py", line 182, in fn_ return fn(*args, **kw) File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\mapping.py", line 1026, in ExportToJPEG layout.exportToJPEG(*args) File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\utils.py", line 182, in fn_ return fn(*args, **kw) File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\arcobjects\mixins.py", line 568, in exportToJPEG return self._arc_object.exportToJPEG(*args) TypeError: PageLayoutObject: Error in executing ExportToJPEG

added 8 characters in body
Source Link
alphabetasoup
  • 9k
  • 4
  • 40
  • 79

I have a script that works to export my pages as jpegs, but I want to add the world file to them. I don't want to have to do all the {df} args and whatnot, I just want to skip to the world file. How can I do this?

Script I currently have:

mxd = arcpy.mapping.MapDocument("CURRENT") ... for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1): ... mxd.dataDrivenPages.currentPageID = pageNum ... arcpy.mapping.ExportToJPEG(mxd, r"D:\Matt_work\jpgs" + str(pageNum) + ".jpg") ... del mxd

mxd = arcpy.mapping.MapDocument("CURRENT")
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
    mxd.dataDrivenPages.currentPageID = pageNum
    arcpy.mapping.ExportToJPEG(mxd, r"D:\Matt_work\jpgs" + str(pageNum) + ".jpg")
del mxd

I have a script that works to export my pages as jpegs, but I want to add the world file to them. I don't want to have to do all the {df} args and whatnot, I just want to skip to the world file. How can I do this?

Script I currently have:

mxd = arcpy.mapping.MapDocument("CURRENT") ... for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1): ... mxd.dataDrivenPages.currentPageID = pageNum ... arcpy.mapping.ExportToJPEG(mxd, r"D:\Matt_work\jpgs" + str(pageNum) + ".jpg") ... del mxd

I have a script that works to export my pages as jpegs, but I want to add the world file to them. I don't want to have to do all the {df} args and whatnot, I just want to skip to the world file. How can I do this?

Script I currently have:

mxd = arcpy.mapping.MapDocument("CURRENT")
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
    mxd.dataDrivenPages.currentPageID = pageNum
    arcpy.mapping.ExportToJPEG(mxd, r"D:\Matt_work\jpgs" + str(pageNum) + ".jpg")
del mxd
deleted 1 character in body; edited tags
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345
Loading
Source Link
Loading