Monday 18 June 2018

Is there limit to number of elements in layout of ArcGIS Pro project manipulated by ArcPy?


Has anyone encountered, or aware of, a limit to the number of elements in an ArcGIS Pro layout that is manipulated by ArcPy?


The reason I ask is that I have created an ArcGIS Pro 1.4.1 project that has one layout and six map frames that I have been happily running a large ArcPy script against that finishes by exporting to PDF and then saving a copy of the project.


As part of the code I incorporate writing a table that incorporates cloning hundreds of text and graphics elements, and this is based on TextElement example 2 from the ArcGIS Pro documentation which:



constructs a graphic table based on data values from a table in a map. The layout was authored with a vertical line named vertLine, a horizontal line named horzLine, and a text element named cellText. Each of the elements were authored with the appropriate symbology and text properties. The element's anchors were also set to the upper left position, and the text element's vertical and horizontal justification were set to upper left.



That works fine but when I add more code to implement a workaround that I am developing for measured grids (because they are not supported until ArcGIS Pro 2.x) that also creates about a hundred text elements, this new set of text elements do not appear in the exported PDF or the project saved as a copy, but using print statements in the code I can see that they are present in the original manipulated project.


As soon as I comment out the TextElement example 2 code, the measured grid text elements start to appear in both the exported PDF and the project saved as a copy. This leads me to theorize that I have encountered a limit to how many layout elements ArcGIS Pro can support when one of its projects is manipulated by ArcGIS Pro.


I have not yet included a code snippet here, in case someone already has one that they can offer, but I believe I will be able to run up a code snippet that illustrates this.




Answer



I think that there is/was an undocumented limit to the number of graphic/text/layout elements at ArcGIS Pro 1.4 (and later, tested to 2.0.1).


To workaround it I dramatically reduced the number of layout elements needed in my project by creating a polygon feature class, representing the table's cells, so that I could outline and label it within a single map frame, that was a window onto a map with a layer that had that feature class as its source.


The technique for doing this, with all code, is available as a Udemy eLearning course titled Challenging Times with Python and ArcPy for ArcGIS Pro.


Disclosure: I am the author and presenter of that course which is not free.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...