Cannot iterate Export Topology Errors GP tool

690
5
09-17-2018 03:37 PM
ChrisDonohue__GISP
MVP Alum

I'm trying to batch automate Topology Error checking for a project we are working on with many layers.  I've already automated the generation of Topology creation and a Validation, but would now like to use the handy "Export Topology Errors" geoprocessing tool on the many of topologies that have been created.  But what I am finding is that there does not appear to be a way to pull the topology that was iterated into the Export Topology Errors geoprocessing tool.  The "Base Name" will seed in, but the Iterator topology result will not seed in for the "Input Topology".

This is all being run on ArcGIS Desktop 10.4.1 with an Advanced User license.  The topologies are all in the same file geodatabase feature dataset.

Simplified model with just an iterator and the Export Topology Errors GP tool.

Here are the Iterator settings:

Attempting to connect the output topology from the Iterator.  Note that it does not offer the option to make it an input.

Note that the Export Topology Errors geoprocessing tool works fine if I run it manually on each layer.  It's the Iteration part where it doesn't seem usable.

In terms of why this is not working, the only idea I have at this point is that it is one of those not-so-obvious processes where one has to do some sort of intermediate step first when connecting the two, like running a Make Feature Layer on the Topology before feeding it into the Export Topology Errors.  But when I try to do that the output is not recognized as a valid input either for Export Topology Errors.

Chris Donohue, GISP

0 Kudos
5 Replies
DanPatterson_Retired
MVP Emeritus

is you output workspace set? somewhere?

0 Kudos
JoeBorgione
MVP Emeritus

Chris- you don't need to perform a make feature layer on the topology itself.  I'm not real sharp when it comes to the model iterator; I like iterating through a python list. If all the topologies are within the same featuredataset, how/why do you iterate datasets?   I'd look at it as creating a list of the toplogies using list datasets, step through that and export your errors, one topology at a time.

If you need more specifics, post up a picture of your database tree in Catalog and I'll spin something up in python for you.

That should just about do it....
0 Kudos
ChrisDonohue__GISP
MVP Alum

This sounds like it has possibilities.  I am not great at Python, so fell back on something I know fairly well to help get this fire out, er, I mean, complete this project given that we were short on time. 

I ended up doing the Export Topology Errors manually for all the topologies, but now that things have slowed down for a minute, am curious on how one could make this work otherwise for when we need to do it again in the near future.  As a Python approach, if I used List Datasets to compile a list of all the Topologies, what would you recommend as a looping mechanism in Python to find each and then run Export Topology Errors?  Would that be os.walk?  Or would it be a process of getting a count from the List Datasets once compiled and then using While?  I have not done much with Python and looping, so am curious what approaches are available.

Chris Donohue, GISP

0 Kudos
ChrisDonohue__GISP
MVP Alum

The output workspace is set to the TopologyErrors Feature Dataset (the blue bubble leading into the Export Topology Errors geoprocessing tool.  This Feature Dataset is in the same File Geodatabase as the source data, and its all on my C: drive.

I also tried sending the output back to the same feature dataset that the origin topologies are stored in ("Topology"), but that didn't work either.

Chris Donohue, GISP

0 Kudos
JoeBorgione
MVP Emeritus

Something like this (untested):

import arcpy
arcpy.env.workspace = r'DriveLetter:\and\path\to\the\.gdb'
out_path = r'DriveLetter:\and\path\to\the\output.gdb'

topo_list = arcpy.ListDatasets('*','TOPOLOGY')

for t in topo_list:
    arcpy.ExportTopologyErrors_management(t,out_path,t)
    

Where the name of the topology is the base name.....

That should just about do it....