0

I've been trying to code a script to export my map series to tiff. I was able to do this in ArcMap but am unable to figure it out by myself in ArcGIS Pro.

Can you help me with my basic code T_T ...it was copied from one of the geonet helpdesk posts. Tried to switch it up to TIFF instead of PDF export.

aprx = arcpy.mp.ArcGISProject(r"import_path")

arcpy.env.overwriteOutput = True

out_tiff = (r"export_path")

lytlist = aprx.listLayouts()[0]

if not lytlist.mapSeries is None:

    mseries = lytlist.mapSeries

    if mseries.enabled:

         mseries.exportToTIFF(out_tif + "iOV", multiple_files='TIFF_MULTIPLE_FILES_PAGE_NAME', resolution=300, tiff_compression = "NONE", image_quality = "BEST")

It errors that 'MapSeries' object has no attribute 'exportToTIFF' ...which i'm sure is a rly easy thing to fix, but I don't have much experience with coding.

4
  • 1
    There is no exportToTiff method, only exportToPdf. But look the second example at the bottom of the help: MapSeries example 2 how to export to another format than pdf. – BERA Apr 24 '20 at 9:17
  • The second example uses exporttopng ....what am i missing? Is the l. in front significant? – Matej Kure Apr 24 '20 at 9:41
  • On l, which is a layout object, you call it lytlist. (pro.arcgis.com/en/pro-app/arcpy/mapping/layout-class.htm) – BERA Apr 24 '20 at 9:45
  • I've been here before. I guess i gotta dig deeper. Cheers – Matej Kure Apr 24 '20 at 9:49
1

I'm afraid this is a classic example of not reading the help file! You need to get smarter with navigating the help file if you intend to edit other peoples code so you understand what you can and cannot do.

The Map Series object has no method exportToTIFF, if you study the Methods section it only supports exportToPDF. So you have just basically made up something that does not exist.

It is the Layout that supports exportToTIFF and this is where you get smarter with navigating the help file, keep scrolling down! You always get a code example of how to use that particular function/object. This is a good way of understanding how to use arcpy.

3
  • Tnx for the feedback. I was thinking it wasn't an option yesterday and that the exporttotiff works only for map frame (since its sectioned under that in the python classes) But the second code example under MapSeries help section, exports to PNG doesn't it? It also states that it can export to other formats than just PDF..... I'm a complete noob i'm telling ya... – Matej Kure Apr 24 '20 at 9:34
  • The second example that @BERA points out is using the layout (the object called l) to export to PNG but it is using map series to move the the view to a different part of the layout. So what you need to do is look at the help file for layout and understand how to swap out export to PNG to export to TIFF. So for you it would be a change of 2 lines of code, the first and the last. – Hornbydd Apr 24 '20 at 9:43
  • Ok....thanks for the directions.... – Matej Kure Apr 24 '20 at 9:47
0

This is what i have for now

aprx = arcpy.mp.ArcGISProject("CURRENT")
lyt = aprx.listLayouts("LYTNAME")[0]
if not lyt.mapSeries is None:   
   ms = lyt.mapSeries   
   if ms.enabled:     
              pageName = lyt.mapSeries.pageRow.NOMENKLA
lyt.exportToTIFF(r"EXPRTPTH" + pageName, resolution=300, tiff_compression = "NONE")

It exports only 1 page and compression LZW.

Can you give me some directions on how to set it up so it exports every page in the map series. And how to set up the compression to none. Thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.