|
IDEA
|
Thanks for adding this idea. We we consider it this for near term development. Jeff - arcpy.mp and Layout teams.
... View more
06-21-2022
11:29 AM
|
0
|
0
|
2581
|
|
IDEA
|
@DougBrowning @PhilipMarty @JenMar_ Ah, I couldn't resist so I created a very simple script that creates 2 pages for every page in a map series. The first is a map centric page based on a map series and the second page is a dynamic table (also based on a map series). Both pages are synchronized to use the same map series page number. They both don't need to use a map series. You can use whatever logic you want. Here is a snippet of code that does it all: import arcpy, os, sys relpath = os.path.dirname(sys.argv[0]) #Set file name and remove if it already exists pdfPath = os.path.join(relpath, "Final.pdf") if os.path.exists(pdfPath): os.remove(pdfPath) #Create the file and append pages pdfDoc = arcpy.mp.PDFDocumentCreate(pdfPath) #Reference project and appropriate layouts and map series objects p = arcpy.mp.ArcGISProject(os.path.join(relpath, "MSWith2PagesPerPage.aprx")) #Landscape layout with dynamic Map Series table lyt2 = p.listLayouts('TableData_MS')[0] ms2 = lyt2.mapSeries #Portrait layout with Main Map Frame and Locator Map Frame with map series lyt1 = p.listLayouts('Layout_MS')[0] ms1 = lyt1.mapSeries #Iterate through each map series page driven by Layout_MS for pageNum in range(1, ms1.pageCount + 1): #Set the Map Series page, export, and append to the final output ms1.currentPageNumber = pageNum lyt1Output = os.path.join(relpath, "TempPageA.pdf") lyt1.exportToPDF(lyt1Output) pdfDoc.appendPages(lyt1Output) os.remove(lyt1Output) #Clean up temporary file after appending #Sync the second layout to match the same Map Series and export ms2.currentPageNumber = pageNum lyt2Output = os.path.join(relpath, "TempPageB.pdf") lyt2.exportToPDF(lyt2Output) pdfDoc.appendPages(lyt2Output) os.remove(lyt2Output) #Clean up temporary file after appending pdfDoc.saveAndClose()
... View more
06-15-2022
04:50 PM
|
0
|
0
|
3554
|
|
IDEA
|
@DougBrowning @PhilipMarty @JenMar_ A multi-page export per Map Series page is completely doable using arcpy.mp. The UI does NOT provide these capabilities but the arcpy.mp API does. All a spatial map series is are a bunch of properties that are based on the extent of each index feature. If you use Python to drive the map series export (vs the UI), you can inject additional logic between each MapSeries page export. This even includes updating the extent of a map frame in another layout. The closest example I can think of is a sample I wrote for ArcMap Data Driven pages (not updated but the logic is identical). This example, uses 2 MXDs because only one layout per MXD is possible. But Pro supports multiple layouts so you don't need multiple projects. https://www.arcgis.com/home/item.html?id=41f949b33f614f78a6dee485c4aaa5a8 Take a look at the code - it displays two map frames (even pages and odd pages) on a single layout rather than being forced to have one PDF per map series page. You will see the main loop is based on one MXD that drives the data driven pages (in Pro called Map Series) and the second MXD has two separate map frames. The extra logic happens between pages and the exactly one PDF is exported for every two strip index features. It uses arcpy.mp to append the pages in the correct order creating a final, single, multi-page PDF. One of you even mentioned NOT exporting a map series page if particular criteria are not met - using Python you decided when to export, etc. If this sample does NOT make any sense at all, I can try to write up a snippet but the logic will be the same. Jeff
... View more
06-15-2022
03:24 PM
|
0
|
0
|
3558
|
|
IDEA
|
@RossVolkwein1 Sorry about that. I'm using Pro 3.0. I'll update the script above. Jeff
... View more
06-13-2022
02:06 PM
|
0
|
0
|
4780
|
|
IDEA
|
Starting with Pro 2.5, this can be accomplished using Python CIM Access https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/python-cim-access.htm Here is a simple snippet: p = arcpy.mp.ArcGISProject('current') lyt = p.listLayouts()[0] lyt_cim = lyt.getDefinition('V2') #for 2.x and '3.0' for 3x for e in lyt_cim.elements: if e.name == 'Rectangle': print(elm.anchor) ###BottomLeftCorner
... View more
06-13-2022
08:13 AM
|
0
|
0
|
4794
|
|
IDEA
|
Starting with Pro 2.5, this can be accomplished using Python CIM Access https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/python-cim-access.htm Here is a simple snippet: p = arcpy.mp.ArcGISProject('current') lyt = p.listLayouts()[0] lyt_cim = lyt.getDefinition('V3') for e in lyt_cim.elements: if e.name == 'Rectangle': print(elm.anchor) ###BottomLeftCorner
... View more
06-13-2022
08:10 AM
|
0
|
0
|
4795
|
|
POST
|
Duncan, we figured it out. MapFrames were hard-coded to pageunits=inches and you were using mm. The extent was so far off because of the conversion from units to pixel space, etc. We should have this fixed in Pro 3.0. So the work around continues to be what I suggested above or changing your page units to inches (which I know is not something you may want to do). Thank you so much for reporting this. I'm surprised it took so long to be discovered. Jeff - Layout and arcpy.mp teams.
... View more
05-13-2022
12:31 PM
|
0
|
4
|
4288
|
|
POST
|
One possibility is to include Python with your solution. Python has all sorts of file management functions. For example: if os.path.exists(os.path.join(someFolderPath, someFileName)) do something else: do something else
... View more
05-13-2022
10:56 AM
|
0
|
1
|
793
|
|
IDEA
|
We started to prototype removing project items recently. Our current plan it to support this at Pro 3.1. Jeff - Layout and arcpy.mp teams
... View more
05-13-2022
09:06 AM
|
0
|
0
|
7756
|
|
POST
|
Duncan, We have your repro steps and we are looking into it. In the meantime, a possible workaround it so customize the size of the Layout to be the same size as the MapFrame and then export the Layout instead of the MapFrame. The layout is exporting with the proper map frame extent as you indicate.
... View more
05-13-2022
09:03 AM
|
0
|
5
|
4289
|
|
POST
|
Thanks Duncan. I can reproduce the issue with your data / script. If I apply your scripting logic to data I have, I can NOT reproduce. I will continue to dig. I'm curious, is this the only data you can reproduce the issue with? Also - are you getting unusually slow export times? For me, it is even slower if I modify your script to work outside of the application.
... View more
05-10-2022
10:43 AM
|
0
|
7
|
4305
|
|
POST
|
I was running your code in the Python Window. You are more than welcome to send me a small PPKX so I can ensure we don't have an extent bug. [email protected] - Layout and arcpy.mp teams
... View more
05-09-2022
09:31 AM
|
0
|
9
|
4320
|
|
POST
|
We provided a fix in the ArcGIS Pro 2.9.2 patch that addressed issues with > 10 anno subclasses. Can you confirm that you are on 2.9.2? If you are could you provide a screen shot of your problem anno subclass properties? Thanks, Jeff - Layout and arcpy.mp teams
... View more
05-06-2022
11:37 AM
|
0
|
3
|
4162
|
|
POST
|
Hello Duncan, I can NOT reproduce the issue. The script successfully sets the MF extent by zooming to the features that match the Def Query. For me the exported PNG extent matches the MapFrame extent I see on the layout. Lines 21 and 22 do not make sense to me in the context of exporting a MapFrame. You must be running the script with the LayoutView active instead of the map view. If I activate the MapView and run your script, it all works as expected: The MapView extent is only panned, while the MapFrame extent is zoomed to the QueryDef features. I tried all this on 2.9. If you could provide more detail, I'd be happy to look futher. Jeff - Layout and arcpy.mp teams
... View more
05-06-2022
10:51 AM
|
0
|
11
|
4334
|
|
POST
|
@DanaNajeeb Do you want the text to appear 1) in a static location on the layout OR 2) as a label in the map as if you were labeling only selected features? Here is a solution for #1. It first ensures there is only 1 selected feature. You may have a different scenario. p = arcpy.mp.ArcGISProject('current')
m = p.listMaps('Map')[0]
l = m.listLayers('GreatLakes')[0]
#Ensure one feature is selected, then get value
numRows = int(arcpy.GetCount_management(l).getOutput(0))
if numRows == 1:
table = arcpy.SearchCursor(l, ['OBJECTID'])
for row in table:
value = row.getValue('OBJECTID')
else:
exit
#Reference layout and set text value
lyt = p.listLayouts()[0]
t = lyt.listElements('TEXT_ELEMENT', "MyText")[0]
t.text = value Depending on the details, for #2 an easier route might be to have a secondary layer for labeling and then apply a def query to that layer to match the selected features. I guess this only works if a def query was used to create the selection in the first place. Devil is in the details. Jeff - Layout and arcpy.mp Teams Here is code that will work with the easier scenario: static text location on a layout. I first ensure there is only one selected feature. Devil is in the details.
... View more
04-22-2022
08:15 AM
|
0
|
1
|
1826
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-05-2025 11:20 AM | |
| 3 | 06-05-2025 09:21 AM | |
| 1 | 05-14-2025 01:19 PM | |
| 2 | 04-24-2025 07:54 AM | |
| 1 | 03-15-2025 07:19 PM |
| Online Status |
Offline
|
| Date Last Visited |
2 weeks ago
|