Skip to main content
Rollback to Revision 8
Source Link
Vince
  • 20.3k
  • 16
  • 48
  • 65

What do I need to change to migrate this ArcMap code to ArcGIS Pro?

It is used to export hundreds of maps and did its job perfectly.

I got the code from this Q&A: https://gis.stackexchange.com/a/67520/157904

    >>> import_path = r"P:\project.mxd"   # Path of .mxd
export_path = r"P:\"   # Path of output file
field_name = "Taxon" # Name of field used to sort DDP

... mxd = arcpy.mapping.MapDocument(import_path) 
... for i in range(1, mxd.dataDrivenPages.pageCount + 1):
...    mxd.dataDrivenPages.currentPageID = i
...    row = mxd.dataDrivenPages.pageRow
...    print row.getValue(field_name)
...    arcpy.mapping.ExportToJPEG(mxd, export_path + "." + row.getValue(field_name) + ".jpg",resolution=600) 
... del mxd

This is the error message I get (after @BERAs adaption):

AttributeError Traceback (most recent call last) In [3]: Line 5: ... mxd = arcpy.mapping.MapDocument(import_path)

AttributeError: module 'arcpy' has no attribute 'mapping'

Do I have to change arcpy.mapping.MapDocument(import_path) with arcpy.mp.ArcGISProject(aprx_path)?

What do I need to change to migrate this ArcMap code to ArcGIS Pro?

It is used to export hundreds of maps and did its job perfectly.

I got the code from this Q&A: https://gis.stackexchange.com/a/67520/157904

    >>> import_path = r"P:\project.mxd"   # Path of .mxd
export_path = r"P:\"   # Path of output file
field_name = "Taxon" # Name of field used to sort DDP

... mxd = arcpy.mapping.MapDocument(import_path) 
... for i in range(1, mxd.dataDrivenPages.pageCount + 1):
...    mxd.dataDrivenPages.currentPageID = i
...    row = mxd.dataDrivenPages.pageRow
...    print row.getValue(field_name)
...    arcpy.mapping.ExportToJPEG(mxd, export_path + "." + row.getValue(field_name) + ".jpg",resolution=600) 
... del mxd

What do I need to change to migrate this ArcMap code to ArcGIS Pro?

It is used to export hundreds of maps and did its job perfectly.

I got the code from this Q&A: https://gis.stackexchange.com/a/67520/157904

    >>> import_path = r"P:\project.mxd"   # Path of .mxd
export_path = r"P:\"   # Path of output file
field_name = "Taxon" # Name of field used to sort DDP

... mxd = arcpy.mapping.MapDocument(import_path) 
... for i in range(1, mxd.dataDrivenPages.pageCount + 1):
...    mxd.dataDrivenPages.currentPageID = i
...    row = mxd.dataDrivenPages.pageRow
...    print row.getValue(field_name)
...    arcpy.mapping.ExportToJPEG(mxd, export_path + "." + row.getValue(field_name) + ".jpg",resolution=600) 
... del mxd

This is the error message I get (after @BERAs adaption):

AttributeError Traceback (most recent call last) In [3]: Line 5: ... mxd = arcpy.mapping.MapDocument(import_path)

AttributeError: module 'arcpy' has no attribute 'mapping'

Do I have to change arcpy.mapping.MapDocument(import_path) with arcpy.mp.ArcGISProject(aprx_path)?

deleted 395 characters in body
Source Link
LZc
  • 29
  • 6

What do I need to change to migrate this ArcMap code to ArcGIS Pro?

It is used to export hundreds of maps and did its job perfectly.

I got the code from this Q&A: https://gis.stackexchange.com/a/67520/157904

    >>> import_path = r"P:\project.mxd"   # Path of .mxd
export_path = r"P:\"   # Path of output file
field_name = "Taxon" # Name of field used to sort DDP

... mxd = arcpy.mapping.MapDocument(import_path) 
... for i in range(1, mxd.dataDrivenPages.pageCount + 1):
...    mxd.dataDrivenPages.currentPageID = i
...    row = mxd.dataDrivenPages.pageRow
...    print row.getValue(field_name)
...    arcpy.mapping.ExportToJPEG(mxd, export_path + "." + row.getValue(field_name) + ".jpg",resolution=600) 
... del mxd

This is the error message I get (after @BERAs adaption):

AttributeError Traceback (most recent call last) In [3]: Line 5: ... mxd = arcpy.mapping.MapDocument(import_path)

AttributeError: module 'arcpy' has no attribute 'mapping'

Do I have to change arcpy.mapping.MapDocument(import_path) with arcpy.mp.ArcGISProject(aprx_path)?

What do I need to change to migrate this ArcMap code to ArcGIS Pro?

It is used to export hundreds of maps and did its job perfectly.

I got the code from this Q&A: https://gis.stackexchange.com/a/67520/157904

    >>> import_path = r"P:\project.mxd"   # Path of .mxd
export_path = r"P:\"   # Path of output file
field_name = "Taxon" # Name of field used to sort DDP

... mxd = arcpy.mapping.MapDocument(import_path) 
... for i in range(1, mxd.dataDrivenPages.pageCount + 1):
...    mxd.dataDrivenPages.currentPageID = i
...    row = mxd.dataDrivenPages.pageRow
...    print row.getValue(field_name)
...    arcpy.mapping.ExportToJPEG(mxd, export_path + "." + row.getValue(field_name) + ".jpg",resolution=600) 
... del mxd

This is the error message I get (after @BERAs adaption):

AttributeError Traceback (most recent call last) In [3]: Line 5: ... mxd = arcpy.mapping.MapDocument(import_path)

AttributeError: module 'arcpy' has no attribute 'mapping'

Do I have to change arcpy.mapping.MapDocument(import_path) with arcpy.mp.ArcGISProject(aprx_path)?

What do I need to change to migrate this ArcMap code to ArcGIS Pro?

It is used to export hundreds of maps and did its job perfectly.

I got the code from this Q&A: https://gis.stackexchange.com/a/67520/157904

    >>> import_path = r"P:\project.mxd"   # Path of .mxd
export_path = r"P:\"   # Path of output file
field_name = "Taxon" # Name of field used to sort DDP

... mxd = arcpy.mapping.MapDocument(import_path) 
... for i in range(1, mxd.dataDrivenPages.pageCount + 1):
...    mxd.dataDrivenPages.currentPageID = i
...    row = mxd.dataDrivenPages.pageRow
...    print row.getValue(field_name)
...    arcpy.mapping.ExportToJPEG(mxd, export_path + "." + row.getValue(field_name) + ".jpg",resolution=600) 
... del mxd

tyop in edit
Source Link
Vince
  • 20.3k
  • 16
  • 48
  • 65

IWhat do I need to change to migrate this ArcMap code to ArcGIS Pro?

It is used to export hundreds of maps and did its job perfectly.

I got the code from this Q&A: https://gis.stackexchange.com/a/67520/157904

    >>> import_path = r"P:\project.mxd"   # Path of .mxd
export_path = r"P:\"   # Path of output file
field_name = "Taxon" # Name of field used to sort DDP

... mxd = arcpy.mapping.MapDocument(import_path) 
... for i in range(1, mxd.dataDrivenPages.pageCount + 1):
...    mxd.dataDrivenPages.currentPageID = i
...    row = mxd.dataDrivenPages.pageRow
...    print row.getValue(field_name)
...    arcpy.mapping.ExportToJPEG(mxd, export_path + "." + row.getValue(field_name) + ".jpg",resolution=600) 
... del mxd

This is the error message I get (after @BERAs adaption):

AttributeError Traceback (most recent call last) In [3]: Line 5: ... mxd = arcpy.mapping.MapDocument(import_path)

AttributeError: module 'arcpy' has no attribute 'mapping'

Do I have to change arcpy.mapping.MapDocument(import_path) with arcpy.mp.ArcGISProject(aprx_path)?

I do I need to change to migrate this ArcMap code to ArcGIS Pro?

It is used to export hundreds of maps and did its job perfectly.

I got the code from this Q&A: https://gis.stackexchange.com/a/67520/157904

    >>> import_path = r"P:\project.mxd"   # Path of .mxd
export_path = r"P:\"   # Path of output file
field_name = "Taxon" # Name of field used to sort DDP

... mxd = arcpy.mapping.MapDocument(import_path) 
... for i in range(1, mxd.dataDrivenPages.pageCount + 1):
...    mxd.dataDrivenPages.currentPageID = i
...    row = mxd.dataDrivenPages.pageRow
...    print row.getValue(field_name)
...    arcpy.mapping.ExportToJPEG(mxd, export_path + "." + row.getValue(field_name) + ".jpg",resolution=600) 
... del mxd

This is the error message I get (after @BERAs adaption):

AttributeError Traceback (most recent call last) In [3]: Line 5: ... mxd = arcpy.mapping.MapDocument(import_path)

AttributeError: module 'arcpy' has no attribute 'mapping'

Do I have to change arcpy.mapping.MapDocument(import_path) with arcpy.mp.ArcGISProject(aprx_path)?

What do I need to change to migrate this ArcMap code to ArcGIS Pro?

It is used to export hundreds of maps and did its job perfectly.

I got the code from this Q&A: https://gis.stackexchange.com/a/67520/157904

    >>> import_path = r"P:\project.mxd"   # Path of .mxd
export_path = r"P:\"   # Path of output file
field_name = "Taxon" # Name of field used to sort DDP

... mxd = arcpy.mapping.MapDocument(import_path) 
... for i in range(1, mxd.dataDrivenPages.pageCount + 1):
...    mxd.dataDrivenPages.currentPageID = i
...    row = mxd.dataDrivenPages.pageRow
...    print row.getValue(field_name)
...    arcpy.mapping.ExportToJPEG(mxd, export_path + "." + row.getValue(field_name) + ".jpg",resolution=600) 
... del mxd

This is the error message I get (after @BERAs adaption):

AttributeError Traceback (most recent call last) In [3]: Line 5: ... mxd = arcpy.mapping.MapDocument(import_path)

AttributeError: module 'arcpy' has no attribute 'mapping'

Do I have to change arcpy.mapping.MapDocument(import_path) with arcpy.mp.ArcGISProject(aprx_path)?

removed helpme
Source Link
Vince
  • 20.3k
  • 16
  • 48
  • 65
Loading
edited tags
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345
Loading
added 140 characters in body
Source Link
LZc
  • 29
  • 6
Loading
added 72 characters in body
Source Link
LZc
  • 29
  • 6
Loading
appended answer 455631 as supplemental
Source Link
Ian Turton
  • 83.2k
  • 6
  • 89
  • 189
Loading
edited tags
Link
Ian Turton
  • 83.2k
  • 6
  • 89
  • 189
Loading
Source Link
LZc
  • 29
  • 6
Loading