I have a web application where folks upload a zipped up file geodatabase, I unzip it and manipulate the feature classes and then transfer them using insert cursors to an SDE database. I am wondering if I can apply topology rules to the input feature classes to get rid of polygon slivers. I know I can add topology to the file geodatabase they input, the problem is that I don't know if you can automate the fixing of the topology errors with python. Everything I've read thus far makes it seem like you can validate with python and export an error report, but to actually fix the errors you must put the layer into ArcMap and manually do it. Is it possible to fix topology errors using python automation?

If it's not possible, I'm thinking my best option is probably to use the Eliminate tool on the input feature classes before running them through the rest of the script that manipulates attributes and geometry.

  • Not sure, but doesnt Validate Topology fix the errors? (desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/…) – BERA Feb 5 '18 at 17:37
  • @BERA - Hm, perhaps I do not understand topology as well as I thought. I thought that the Validate Topology tool simply gives you a report of what violates what and then in ArcMap you can go one by one to each erroneous feature and fix them manually (bullet point says: Running a set of integrity checks to identify any violations of the rules that have been defined for the topology). So, if I ran the tool and there was a polygon sliver, it could tell me where/what is violating the topology rule I have set about slivers, but can't actually fix the sliver for me. Guess I'll investigate further. – MKF Feb 5 '18 at 18:24
  • Topology toolbar and Error Inspector can fix some errors interactively within ArcMap, line errors such as dangles can be cut or extended pretty easily. Polygons are harder. Topology validation does create lots of geometry records, which you could use later to view and fix errors using editing or geoprocessing tools, so Python could help. But, you also need to keep in mind that validation is hugely faster in a file geodatabase than in SDE. You have to unregister/register as versioned in SDE to get validation to work. – danak Feb 5 '18 at 18:35
  • @danak - Thanks for your input. I need to fix things automatically inside of Python before the input feature class hits the rest of the script, so I have gone a different direction; I won't be using topology since it appears there is no way to read the errors from validation programmatically. Instead I'll be looking at the areas of each polygon, determining what ones are under the set threshold, and using the eliminate tool to absorb slivers into larger polygons. This achieves what I need it to. – MKF Feb 8 '18 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.