TopologyException in SDR | InVEST 3.17

Hello everyone!

I am trying to run SDR (Sediment Delivery Ratio) model in InVEST, bust the model crashes during execution with the following error message:

2026-01-26 10:30:36 natcap.invest.utils ERROR Exception while executing sdr
Traceback (most recent call last):
File “natcap\invest\utils.py”, line 171, in prepare_workspace
File “natcap\invest\spec.py”, line 2194, in execute
File “natcap\invest\sdr\sdr.py”, line 1005, in execute
File “taskgraph\Task.py”, line 684, in add_task
File “taskgraph\Task.py”, line 1103, in _call
File “natcap\invest\sdr\sdr.py”, line 1574, in _generate_report
File “natcap\invest\urban_nature_access.py”, line 1578, in _geometries_overlap
File “shapely\ops.py”, line 117, in unary_union
File “shapely\decorators.py”, line 173, in wrapper
File “shapely\decorators.py”, line 88, in wrapped
File “shapely\set_operations.py”, line 553, in union_all
shapely.errors.GEOSException: TopologyException: side location conflict at 105958.42278252472 1827072.958573573. This can occur if the input geometry is invalid.

The traceback indicates that the error occurs during a geometry union operation (shapely.ops.unary_union), but I am not sure which specific input layer or geometry is causing the issue, nor the recommended way to address it within the InVEST SDR workflow.

I expect the SDR model to run successfully and generate the standard outputs using my input datasets, which are all projected to the same CRS and appear spatially consistent. Prior to running SDR, I successfully ran the SWY model using a subset of the same inputs, and it completed without errors.

So far, I have verified that all raster and vector inputs use the same coordinate reference system and spatially overlap as expected. I also visually inspected the vector layers for geometry problems, but did not identify any obvious issues. However, I am unsure how to systematically identify and repair potentially invalid geometries that could be triggering this error, or which specific SDR input layers are involved in the geometry union step.

InVEST-sdr-log-2026-01-26–10_26_57.txt (26.3 KB)

Hi @thais.doria , sorry for the delay in addressing your issue.

The error indicates there is some invalid geometry in the watersheds input layer, specifically at the location (105958.42278252472 1827072.958573573). You could use those coordinates to closely examine the layer in GIS and try to find and fix the invalid geometry, or you could run a GIS tool to check for invalid geometries, or “repair” geometries. But it seems that this specific “side location conflict” may not always reveal itself when using such tools.

Alternatively, you could try running a buffer operation on your watershed polygon input. A “buffer with distance 0” has been known to fix invalid geometries.