Riverscapes / riverscapes-tools

Open-source Python 3.0 tools for the Riverscapes organization
https://tools.riverscapes.net/
GNU General Public License v3.0
10 stars 8 forks source link

GDAL Topology error: Non-Noded Intersection #449

Closed KellyMWhitehead closed 2 years ago

KellyMWhitehead commented 2 years ago
2021-09-29 18:18:53:: [debug] [VectorBase] No layer named "active_floodplain" found
2021-09-29 18:18:53::         PROGRESS: 1 / 10,773  (0%)  Differencing Target Features     (Ellapsed: 0.0 seconds)
2021-09-29 18:20:19:: [error] [GDALError] ERR# 1 -- TopologyException: found non-noded intersection between LINESTRING (-100.709 44.0629, -100.709 44.0629) and LINESTRING (-100.709 44.0629, -100.709 44.0629) at -100.70871383584709 44.062921330697904 0
2021-09-29 18:20:19:: [error] [VBET] TopologyException: found non-noded intersection between LINESTRING (-100.709 44.0629, -100.709 44.0629) and LINESTRING (-100.709 44.0629, -100.709 44.0629) at -100.70871383584709 44.062921330697904 0
2021-09-29 18:20:19:: Traceback (most recent call last):
2021-09-29 18:20:19::   File "/usr/local/src/riverscapes-tools/packages/vbet/vbet/vbet.py", line 642, in main
2021-09-29 18:20:19::     vbet(args.huc, args.scenario_code, inputs, args.vaa_table, args.output_dir, reach_codes, meta, flowline_type=args.flowline_type)
2021-09-29 18:20:19::   File "/usr/local/src/riverscapes-tools/packages/vbet/vbet/vbet.py", line 460, in vbet
2021-09-29 18:20:19::     difference(vbet_channel_area, vbet_threshold['VBET_IA'], active_floodplain, epsg)
2021-09-29 18:20:19::   File "/usr/local/src/riverscapes-tools/lib/commons/rscommons/vector_ops.py", line 933, in difference
2021-09-29 18:20:19::     geom = geom.Difference(geom_diff)
2021-09-29 18:20:19::   File "/usr/local/venv/lib/python3.8/site-packages/osgeo/ogr.py", line 6570, in Difference
2021-09-29 18:20:19::     return _ogr.Geometry_Difference(self, *args)
2021-09-29 18:20:19:: RuntimeError: TopologyException: found non-noded intersection between LINESTRING (-100.709 44.0629, -100.709 44.0629) and LINESTRING (-100.709 44.0629, -100.709 44.0629) at -100.70871383584709 44.062921330697904 0
2021-09-29 18:20:20:: <<RS CONTEXT PROCESS ENDED WITH AN ERROR>>

Hucs: 10140102, 10190002, 09020107, 10020002, others

FAILED-10020002.log

KellyMWhitehead commented 2 years ago

This is a challenging error - GDAL throws an exception if a non-noded intersection is found when differencing two geometries. I was unable to find a way to test for this before calling Difference, so I am just catching the exception here and moving on. This error has occurred on only a handful of geometries so far.

Fix applied in e3804429c6d16148223ee14dfdbc2755831e54da

philipbaileynar commented 2 years ago

What does non-noded intersection mean? Surely most intersections are non-noded?