mapaction / mapaction-toolbox

A collection of tools to help streamline the process of producing maps including data renaming and map exports.
GNU General Public License v3.0
3 stars 1 forks source link

stripESRILabelMarkup() does not strip dynamic text #150

Open andrewphilipsmith opened 7 years ago

andrewphilipsmith commented 7 years ago

When stripping out ESRI markup from Text/Label Elements, the presence of <dyn .... > tag (associated with Data Driven Pages) causes the PageLayoutProperties.stripESRILabelMarkup to fail. For example these test cases all fail. (Each of them have been manually tested by entering them into a text element in ArcMap.)

// Dynamic Page markup, when DDP is disabled
[TestCase(@"11 - The<dyn type='page' property='Name'/> quick brown fox", @"11 - The quick brown fox")]
// Dynamic Page markup, when DDP is disabled
[TestCase(@"12 - The <dyn type='page' property='Name' emptyStr='quick'/> brown fox", @"12 - The quick brown fox")]
// Dynamic Page markup, when DDP is disabled and formating markup
[TestCase(@"13 - The <dyn type='page' property='Name' emptyStr='quick'/> brown <BOL>fox</BOL>", @"13 - The quick brown fox")]
public void TestStripESRILabelMarkup(string input, string expectedOutput)

The other test cases pass.

clairebyrne commented 4 years ago

@andrewphilipsmith since we still get dynamic label tags in the export xmls, I'm assuming this is still a valid bug?

andrewphilipsmith commented 4 years ago

This is still a valid bug.

For a discussion on how to solve it or workaround it, see this stack exchange question: https://gis.stackexchange.com/questions/197173/access-resolved-rendered-dynamic-text-from-arcpy-or-arcobjects

I don't know if we have checked to see if the same limitation exists in the APIs for ArcMap v10.6+

I believe that there are similarities to the "Save the MXD for ArcMap 9.3" in the approach taken in the mapactionpy_arcmap - specificly taking control of iterating through each of the map pages, rather than delegate to arcpy to export the lot in one go. I don't have a sense of how much extra work it would be to build on the save-to-arcmap-9.3 and extract the relevant labels.

Whilst it would be pleasing to see this bug fixed, it would be worth asking:

I don't know the answer to this, but perhaps we could then decide on whether or fix this for just ArcMap, just ArcPro or both.