|
IDEA
|
Arcpy.mp provides the ability to change pages sizes as well as element sizes. Trying to automate the resizing of elements to match 10 possible configurations, including orientation, would NOT be a simple script. The application recently provided new resizing options (see graphic below) that will attempt to resize elements based on a newly chosen page size but the result almost always requires some fine tuning to get everything aligned just the way you would want it. It would only work perfectly if the aspect ratios for all elements are the same. I think the best way to tackle this solution using Python would be to follow the techniques used in this downloadable sample: https://www.arcgis.com/home/item.html?id=82b99b5593e54e57b740e3898fb14c5f It persists all the layout elements, sizes, and positions in a database table. The script reads the table and recreates the layout based on the information in the table. The script/table could easily be modified to include layout size. There is a detailed README in the sample that will provide more detail.
... View more
09-26-2022
08:00 AM
|
0
|
0
|
2218
|
|
IDEA
|
This can be accomplished using arcpy.mp. A sample was provided.
... View more
09-19-2022
09:46 AM
|
0
|
0
|
2239
|
|
IDEA
|
Hello Macbeer, This could be accomplished by iterating through the MapFrames on a layout. Once you have a MapFrame, then you can get to its associated Map. And then you can get to the layers. Here is a snippet: p = arcpy.mp.ArcGISProject('current') for lyt in p.listLayouts(): for mf in lyt.listElements('MapFrame_Element'): m = mf.map print(f"Layout: {lyt.name}, MapFrame: {mf.name}, Map: {m.name}") Here is a screenshot that includes the indents: Jeff - Layout and arcpy.mp teams
... View more
09-19-2022
09:03 AM
|
0
|
0
|
2251
|
|
POST
|
Interesting, the variable inside the quotes works for me. And correct, if the map is already open and not active, zooming won't. We can't identify specific map view by name because a map could have 3 map views, each with different extents. That is why we developed OpenView(). You can either change the default camera extent before opening a view OR use the navigation functions after opening a view. Jeff - Layout and arcpy.mp teams
... View more
09-13-2022
11:00 AM
|
0
|
0
|
3882
|
|
IDEA
|
Teresa, I understand that you may not be familiar with Python map automation. Our APIs are designed to help customers extend the capabilities of the UI while avoiding overloading the UI with options. But that is not to say we won't consider improving the export options in the UI. The script could be modified to iterate through each unique "group" value and do the same export without having to hard code the values in the script. I kept it very simple so you could see the logic vs the interface. Jeff - Layout and arcpy.mp teams
... View more
09-13-2022
09:12 AM
|
0
|
0
|
9239
|
|
POST
|
Here is a snippet of code that works in the application using the current keyword. I'm using a point FC in the first map and using the linkID to zoom to another layer in the second map using the ID. p = arcpy.mp.ArcGISProject('current') m1 = p.listMaps('Map')[0] m2 = p.listMaps('Map1')[0] #M1/layer1 - point FC assuming 1 feature is selected lyr1 = m1.listLayers('PointFC')[0] cursor = arcpy.SearchCursor(lyr1) for row in cursor: linkID = row.getValue("LinkID") print(linkID) #M2/layer2 - zoom to polygon feature lyr2 = m2.listLayers('PolygonFC')[0] lyr2.definitionQuery = "LinkID = linkID" view = m2.openView() view.camera.setExtent(view.getLayerExtent(lyr2, True))
... View more
09-12-2022
07:51 PM
|
1
|
0
|
3894
|
|
IDEA
|
Have you considered Python Map Automation? Groups are based on a field in the index layer. You can simply query for each group to create a selection set and use the selected export option. Here is a snippet of code for the above project: import arcpy, os, sys
p = arcpy.mp.ArcGISProject("CURRENT")
l = p.listLayouts('Layout')[0]
if not l.mapSeries is None:
ms = l.mapSeries
if ms.enabled:
ms = l.mapSeries
indexLyr = ms.indexLayer
#AFC-EAST
arcpy.management.SelectLayerByAttribute(indexLyr, "NEW_SELECTION", "TeamInfo.Conf_Div = 'AFC-EAST'")
ms.exportToPDF(r"C:\Temp\AFC_EAST.pdf", "SELECTED")
#AFC-NORTH
arcpy.management.SelectLayerByAttribute(indexLyr, "NEW_SELECTION", "TeamInfo.Conf_Div = 'AFC-NORTH'")
ms.exportToPDF(r"C:\Temp\AFC_NORTH.pdf", "SELECTED")
... View more
09-12-2022
07:16 PM
|
0
|
0
|
9254
|
|
POST
|
I'd like to learn more about your workflow and why you need to activate a map. Are you working with maps in map views or maps in map frames (on a layout)? At 3.0, we have new functions that allow you to call Map.OpenView() or Layout.OpenView() - this command will open and activate the current view. In terms of referencing multiple maps and passing variable information from one map to another map for the purposes of cursors, changing extents, etc, that all works. Jeff - Layout and arcpy.mp teams.
... View more
09-12-2022
10:53 AM
|
0
|
2
|
3915
|
|
IDEA
|
We are testing a fix for this issue for ArcGIS Pro version 3.1
... View more
09-02-2022
01:37 PM
|
0
|
0
|
2957
|
|
IDEA
|
Greg, Thanks for the clarification. I personally wouldn't give up on python automation, but that's me, a Python automation guy. The second sample was based on a customer project I built for a customer with the exact issue you had. They had 400 individual MXDs and they had such a hard time managing those MXDs. I built a database solution where the misfit layouts configurations were persisted in a table. If the table record existed for that index feature, then the Python script would do its reconfiguration for that page, etc (all run from a single MXD). Anyway, having a tool to create a layout / map for each page in a map series does NOT exist yet BUT at 3.1 implemented a way to createMap() and copyItem. This would allow you to copyItem(Layout) for each map series index feature and createMap for each mapframe, when needed. This seams like a fun project to solve, Jeff - Layout and arcpy.mp teams
... View more
08-25-2022
10:54 AM
|
0
|
0
|
8224
|
|
IDEA
|
Hello Greg, Have you considered Python Map Automation? https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/introduction-to-arcpy-mp.htm I don't know the details of your project but I personally think creating a layout for each map series page can be a bit too much for the project and difficult to make the same updates to all layouts, if ever needed. I'm not clear on how your need "annotate" from page to page but there could be a solution with a single layout. If you are using annotation, those layers could be duplicated, one for each layout, or use a definition query to control the visible anno features. By using python code along with your map series you can customize what happens from page to page. Arcpy.mp can easily control the visibility of layers or set properties like definition query, etc. If you are familiar with Python, we have a couple of samples you might want to evaluate: Go to: https://esriurl.com/arcpy.mp/samples (for all our samples) Then check out: Thematic Map Series and MultipleElementLayoutManager samples The later is a bit more advances in that all information is persisted in a table that controls exactly what gets displayed on a layout. Jeff - Layout and arcpy.mp teams.
... View more
08-25-2022
09:16 AM
|
0
|
0
|
8250
|
|
IDEA
|
Thanks Brett for clarifying the issue. I was able to reproduce your issue and submitted a bug. I noticed that with map.exportToMAPX doesn't throw an error but I don't think the export happens - at least the timestamp isn't updated. exportToPDF(r"C:\Temp\ABC") exportToPDF(r"C:\Temp\ABC") Auto creates the .pdf ext, overwrites output and updates the timestamp. We will make the export experience similar. Thanks again, Jeff - Layout and arcpy.mp teams
... View more
08-24-2022
02:19 PM
|
0
|
0
|
2985
|
|
POST
|
Because the pasted code does NOT show indentation, which is critical for Python code blocks, here is a screen shot of the same code above.
... View more
08-19-2022
09:03 AM
|
0
|
1
|
2123
|
|
POST
|
Hello JMitchell, Have you considered using Python Map Automation? https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/introduction-to-arcpy-mp.htm It is an API that allows you to automate the contents of projects such as maps, layers, layouts and much more. The devil is in the detail but here is a very generic script that exports a PDF for each unique set of DefQueries. The code obviously needs to be modified to work with your project/data and depending on your specific needs, more logic most likely needs to be added. I hope this helps, Jeff - Layout and arcpy.mp teams p = arcpy.mp.ArcGISProject('current') lyt = p.listLayouts('Yosemite National Park')[0] #Build a list of definition queries defQuery1 = "NAME = 'Arch Rock Entrance'" defQuery2 = "NAME = 'Big Oak Flat Entrance'" defQuery3 = "NAME = 'Hetch Hetchy Entrance'" defQueryList = [defQuery1, defQuery2, defQuery3] #Iterate through all the def queries for all the maps #and update layer def queries IF one is present for dq in defQueryList: for m in p.listMaps(): for lyr in m.listLayers(): if lyr.supports("DEFINITIONQUERY"): if lyr.definitionQuery != None: lyr.definitionQuery = dq #build unique outout name based on the defquery string start = "NAME = '" end = " Entrance'" lytNamePath = "C:\\Temp\\" + (dq.split(start))[1].split(end)[0] + ".pdf" #export to PDF before using the next def query lyt.exportToPDF(lytNamePath)
... View more
08-19-2022
09:00 AM
|
0
|
2
|
2123
|
|
POST
|
Map/Report/Layout.openView() Jeff - Layout and arcpy.mp teams
... View more
08-16-2022
04:47 PM
|
0
|
0
|
2197
|
| 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 |
a week ago
|