|
POST
|
Orkhan, It is the same code as the original script but you are just referencing additional data frames. import arcpy mxd = arcpy.mapping.MapDocument("CURRENT") Main_DF = arcpy.mapping.ListDataFrames(mxd, "Main DF")[0] DF_B = arcpy.mapping.ListDataFrames(mxd, "B")[0] DF_C = arcpy.mapping.ListDataFrames(mxd, "C")[0] DF_D = arcpy.mapping.ListDataFrames(mxd, "D")[0] for DDP_Page in range(1, (mxd.dataDrivenPages.pageCount + 1)): mxd.dataDrivenPages.currentPageID = DDP_Page angle = mxd.dataDrivenPages.pageRow.angle DF_B.rotation = angle DF_C.rotation = angle DF_D.rotation = angle
... View more
10-16-2019
07:06 AM
|
2
|
3
|
3799
|
|
POST
|
Thank you for reporting this! You are correct; late in 2.4 development we changed the CamelBack format of the object members to be consistent with the managed API. I failed to update example 3 and you caught it. The script was corrected and will appear in the next help publication. The missing line that you added is NOT required if the symbol already has a dashed effect. What the line did essentially was generate the effect. This is something you need to be very careful about doing. The Developer Summit plenary video does show the line you added. That particular example is a simple use case but due to the complexity of object creation where new objects have dependencies on addition objects, it is easy to create objects that may fail in the application. The arcpy.cim module is necessary for CIM support but we intentionally did not document it. We hope that with future builds we will provide helper functions that will make it easier and more reliable to create new objects. Thanks again, Jeff
... View more
10-10-2019
03:40 PM
|
2
|
2
|
6113
|
|
IDEA
|
In ArcGIS Pro, we have it in our plans to build a thematic map series function as part of the application but in the meantime, it can really only be done using arcpy.mapping (in ArcMap) or arcpy.mp (in Pro). I got this question several times at UC2019 and just recently got it again from a customer using ArcGIS Pro. So below is a very simple example that demonstrates the basic arcpy.mp mechanics (similar to the code above, this same thing can be done in ArcMap with slight modification). In both cases, you do need to modify the paths below. I hope you find this useful, Jeff ### This script is a very simple example of how to use arcpy.mp to create a ### thematic map series. The basic concept is to 1) control layer visibility ### between each export and 2) append the results into a single multi-page PDF. ### Understand there are many ways to manager layer visibility. One way is to ### have a series of group layers with a collection of layers you want displayed. ### A more advanced method is to manage a dictionary or text file that controls ### the layer visibility for each export. ### The example below is very basic. It first toggles off all layers ### except for the basemap. Next it creates a final PDF to store the pages. ### Next it toggles each layer on, exports to PDF, appends the results to the ### final PDF, and then removes the temporary file. It does this for each ### layer. At the very end, it uses the OS to open the final result. import arcpy, os #Reference Project, Layout, MapFrame, and Map p = arcpy.mp.ArcGISProject(r"C:\Temp\GreatLakes\GreatLakes.aprx") lyt = p.listLayouts('Layout')[0] mf = lyt.listElements('MAPFRAME_ELEMENT', 'Map Frame')[0] m = mf.map #Turn off all layers in the map frame's map except the basemap for lyr in m.listLayers(): if not lyr.isBasemapLayer: lyr.visible = False #Create final PDF (and remove if it already exists) pdfPath = r"C:\Temp\GreatLakes\ThematicMapSeries.pdf" if os.path.exists(pdfPath): os.remove(pdfPath) pdf = arcpy.mp.PDFDocumentCreate(pdfPath) #Toggle each layer on, export, append the results, remove temp page for lyr in m.listLayers(): if not lyr.isBasemapLayer: print(lyr.name) lyr.visible = True #toggle on tempFile = os.path.join(r"C:\Temp", lyr.name + ".pdf") lyt.exportToPDF(tempFile) pdf.appendPages(tempFile) os.remove(tempFile) lyr.visible = False #toggle off (before next page) #Commit the PDF and open pdf.saveAndClose() os.startfile(r"C:\Temp\GreatLakes\ThematicMapSeries.pdf")
... View more
08-23-2019
11:15 AM
|
1
|
0
|
6378
|
|
POST
|
Starting with Pro 2.4, Python CIM access is available which will provide finer-grained access to more settings/capabilities. Help topic: https://pro.arcgis.com/en/pro-app/arcpy/mapping/python-cim-access.htm Video: https://www.youtube.com/watch?v=8wgt8bKD0Ww&feature=youtu.be Specific to collapsing layers in the TOC, here is an example: p = arcpy.mp.ArcGISProject('current') m = p.listMaps('Map')[0] l = m.listLayers()[0] l_cim = l.getDefinition('V2') #Get the layer's CIM definition if l_cim.expanded == True: l_cim.expanded = False #Collapse the layer l.setDefinition(l_cim) #Set the updated layer definition
... View more
07-02-2019
11:50 AM
|
1
|
0
|
2735
|
|
POST
|
I really want to thank Earl from Esri Support for being persistent and chasing this down! I did not reproduce because I tested with the project package sent to me - that was a fGDB. Earl submitted a bug and I committed it to our development queue. I prioritized this for 2.5. (it is too late for 2.4). Jeff
... View more
06-18-2019
09:00 AM
|
2
|
1
|
4486
|
|
IDEA
|
Have your tried layer.dataSource? We have made improvements to service layers. p = arcpy.mp.ArcGISProject('current') m = p.listMaps('Map')[0] l = m.listLayers('World Topographic Map')[0] l.dataSource 'https:\\\\www.arcgis.com\\sharing\\rest\\content\\items\\7dc6cea0b1764a1f9af2e679f642f0f5\\resources\\styles\\root.json'
... View more
06-14-2019
07:01 AM
|
0
|
0
|
3637
|
|
IDEA
|
Have your tried layer.dataSource? We have made improvements to service layers. p = arcpy.mp.ArcGISProject('current') m = p.listMaps('Map')[0] l = m.listLayers('World Topographic Map')[0] l.dataSource 'https:\\\\www.arcgis.com\\sharing\\rest\\content\\items\\7dc6cea0b1764a1f9af2e679f642f0f5\\resources\\styles\\root.json'
... View more
06-14-2019
07:01 AM
|
0
|
0
|
1292
|
|
POST
|
Great. A project package is better, it will contain all the map series settings. You can probably get rid of most data, leave the index layer, and save to a temporary aprx before packaging. This is to avoid a huge file size. Jeff
... View more
05-30-2019
08:40 AM
|
0
|
0
|
4486
|
|
POST
|
Hello, I started to reply to this via: https://community.esri.com/message/855395-re-exporttopng-python-for-mapseries I don't know how to reproduce this error. Are you specifying a field to define page numbers? If so, is it numerically defined? If you set this parameter to None, does your code work? You are also welcome to send me a project package to [email protected] Jeff (arcpy.mp team)
... View more
05-30-2019
08:18 AM
|
0
|
2
|
4486
|
|
POST
|
Sorry, I confused the posts/names. Same intention to help. I will look at your other post.
... View more
05-30-2019
08:07 AM
|
1
|
0
|
1692
|
|
POST
|
Hello Elizabeth, I'm sorry for your frustrations. Can you please provide the line of code that specifies the range? Again, I think this may have to do with the field data types. The Page_Range_String parameter does take a string as designed because we want you to be able to export ranges like "1, 3, 5-12" but the exporter needs numbers, not strings. Something like "i, iii, v-vii" can't be supported for a variety of reasons. One work-around, if non numeric characters are necessary for the dynamic text you want to display, is to create another numeric field in your index feature class that has the page order they way you need it in numeric order. FYI - I ran example 2 on my machine and it worked fine. I then changed the page number field to one called "RomanNumerals" and reproduced your original issue. I'm not familiar with how to reproduce your second ValueError. You are welcome to send me your code / a project package to [email protected]. Jeff (arcpy.mp team)
... View more
05-30-2019
07:48 AM
|
0
|
2
|
6486
|
|
POST
|
Please check out Layout snippets 2-4: https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-Layouts Here is a code snippet of mine that looks for all possibilities (examples above combined): //Check to see if the layout already exists LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals("Game Board")); if (layoutItem != null) { Layout lyt = await QueuedTask.Run(() => layoutItem.GetLayout()); //Next check to see if a layout view is already open that referencs the Game Board layout foreach (var pane in ProApp.Panes) { var lytPane = pane as ILayoutPane; if (lytPane == null) //if not a layout view, continue to the next pane continue; if (lytPane.LayoutView.Layout == lyt) //if there is a match, activate the view { (lytPane as Pane).Activate(); System.Windows.MessageBox.Show("Activating existing pane"); return; } } //If panes don't exist, then open a new pane await ProApp.Panes.CreateLayoutPaneAsync(lyt); System.Windows.MessageBox.Show("Opening already existing layout"); return; } //The layout does not exist so create a new one Layout layout = await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run<Layout>(() => { //*** CREATE A NEW LAYOUT ***
... View more
05-24-2019
02:29 PM
|
0
|
1
|
1331
|
|
POST
|
Correct. Only PDF allows a single file output or indvidual files using page number or page name. Same limitation with ArcMap. Currently, the only way to produce multiple non-PDF pages is using arcpy.mp. See example 2 in https://pro.arcgis.com/en/pro-app/arcpy/mapping/mapseries-class.htm We do plan on extended the Pro UI to included other multi-page formats as well. Jeff
... View more
05-10-2019
02:08 PM
|
2
|
0
|
1895
|
|
POST
|
Hello Ann, The reason you might be getting the error is because you may be using a field in your index feature class to drive page numbers. Confirm this by looking at your map series optional settings. There is an optional field called PageNumber. If you are using a field driven page number and page number "1" does NOT exist in that field, you will get the error. I just tried it and could easily reproduce your error message. The script you current have works fine if a PageNumber field is not defined. Rather than trying to iterate through the page numbers and export one page at a time, why not simply export the map series using the separate pages option using page name. You could replace your code with: if mseries.enabled: mseris.exportToPDF(outpath + "JCAtlas", multiple_files='PDF_MULTIPLE_FILES_PAGE_NAME', resolution=150, image_quality = "BEST") Jeff
... View more
05-01-2019
06:29 AM
|
0
|
2
|
6532
|
|
POST
|
This will not be supported for arcpy.mapping (ArcMap). But for Pro 2.4 we added finer grained access to many more capabilities via the CIM - Esri's Cartographic Information Model. Here is a link to the help topic: Python CIM access—ArcPy | Documentation And here is a sample: #The following script will expand all group layers in a map's TOC
# but will collapse all feature and raster layers.
p = arcpy.mp.ArcGISProject('current')
m = p.listMaps('Map')[0]
for l in m.listLayers():
if l.isGroupLayer:
l_cim = l.getDefinition('V2') #get the layer's CIM definition
l_cim.expanded = True #expand group layer
l.setDefinition(l_cim) #set the layer's CIM definition
if l.isFeatureLayer or l.isRasterLayer:
l_cim = l.getDefinition('V2')
l_cim.expanded = False #collapse layers
l.setDefinition(l_cim) Jeff
... View more
04-09-2019
10:33 AM
|
1
|
0
|
2735
|
| 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 |
3 weeks ago
|