Select to view content in your preferred language

ArcGIS Pro 3.1 Legend not exporting correctly for raster data

4756
14
Jump to solution
04-07-2023 07:44 AM
StephenKing3
Regular Contributor

Hello,

Since updating to Pro 3.1 I have been experiencing problems exporting my layout to a graphics file and also printing. Specifically, if I have classified raster data in my map, and use the layout legend option 'Only show features visible in the map extent', the legend for the raster data does not export correctly. Variously, it either does not show any of the data classes at all, or it only shows the first class in the legend list, even if there is more than one class visible in the map layout. This does not happen with vector data using symbology with unique values. The same thing also happens printing to a PDF file or paper. The legend prints correctly without the option selected.

I have tried various solutions including a clean install of Pro.  Esri support have not been able to replicate this so it could be something specific to my machine, however, this wasn't an issue before 3.1. Interestingly, using Python to export works fine.

Has anyone had the same issue and found a workaround? 

Thanks!

0 Kudos
14 Replies
Ben_York
New Contributor

Thank you for finding a workaround...its unfortunate that setting isn't working since this is essential to a bulk of the the figures I produce.  pretty critical feature already not working after upgrading to 3.1

0 Kudos
OliverScheidegger
Emerging Contributor

One further work around is to copy and paste as an image that part of the legend that doesn't export to pdf.

0 Kudos
CVWDGIS
Emerging Contributor

Hi all,

I am also having this issue and the easiest fix I've found is to convert the legend to graphics. Right click the legend object and 'Convert to Graphics.' Be sure that the legend is finalized, as you'll not be able to make any further adjustments after it is converted. This allows you to maintain the 'Only show features visible in the map extent' setting. Still need to fix the bug, but this is a solid work-around. 

FraserLumb
New Contributor

I have been having this issue and found exporting using the python terminal is good workaround. 

For a one page map something as simple as the below would work: 

import arcpy

# Reference the CURRENT project
project = arcpy.mp.ArcGISProject("CURRENT")

# Reference the active layout
layout = project.listLayouts()[0] # Change index based on your active layout

# Export the current layout view to a PDF
layout.exportToPDF(r"C:\path\to\output\your_output.pdf")

print("PDF export completed.")

For a map series you would need to export all series pages individually (i use temp files) and then combine in to one, the below worked for me: 

import arcpy
import os

# Reference the CURRENT project
project = arcpy.mp.ArcGISProject("CURRENT")

# Reference the active layout
layout = project.listLayouts()[0] # Change index based on your active layout

# Check if the layout has a map series
if layout.mapSeries is not None:
ms = layout.mapSeries

# Create a PDF document to append pages
final_pdf = arcpy.mp.PDFDocumentCreate(r"C:\path\to\output\final_output.pdf")

# Loop through each page in the map series and export
for pageNum in range(1, ms.pageCount + 1):
ms.currentPageNumber = pageNum
temp_pdf_path = r"C:\path\to\output\temp_map_{}.pdf".format(pageNum)
print(f"Exporting page {pageNum}...")
layout.exportToPDF(temp_pdf_path)
final_pdf.appendPages(temp_pdf_path)
os.remove(temp_pdf_path) # Delete the temporary file

# Save and close the final PDF
final_pdf.saveAndClose()

print("PDF export completed.")

0 Kudos
OliverScheidegger
Emerging Contributor
Yes, agree. Export via python terminal works for me too. Legend appears normally.
0 Kudos