# Watersheds shapefile related error - Annual water yield - InVEST 3.9.0

**URL:** <https://community.naturalcapitalalliance.org/t/watersheds-shapefile-related-error-annual-water-yield-invest-3-9-0/1753>\
**Category:** Software Support\
**Tags:** annual-water-yield\
**Created:** [March 9, 2021, 4:23pm UTC](https://community.naturalcapitalalliance.org/t/watersheds-shapefile-related-error-annual-water-yield-invest-3-9-0/1753 "2021-03-09T16:23:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![denzilroy](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/denzilroy/32/957_2.png) [@denzilroy](https://community.naturalcapitalalliance.org/u/denzilroy)\
**Post date:** [March 9, 2021, 4:23pm UTC](https://community.naturalcapitalalliance.org/t/watersheds-shapefile-related-error-annual-water-yield-invest-3-9-0/1753/1 "2021-03-09T16:23:48Z")

</div>

Hi NatCap team,

I’ve been running into a “shapely.errors.WKBReadingError” when I run the Annual Water Yield model. The following are some troubleshooting steps I have tried.

1. I re-created the required raster files using an area of interest shapefile that fully enclosed the watershed shapefile in spatial extent.

2. I checked the watershed shapefile in QGIS3 using the Topology Checker plugin for the rule “must not have invalid geometry”.

Can you please help me understand the attached error log?

Thank you.

P.S.:The model runs without error when I use a different watershed shapefile (for a smaller watershed within the same area of interest)

[InVEST-Hydropower-Water-Yield-log-2021-03-09–21\_14\_58.txt](https://community.naturalcapitalalliance.org/uploads/short-url/fCyfM0F6N7iB4b9ct4xOjIRqBG.txt) (10.9 KB)

---

<div class="post-metadata">

**Author:** ![esoth](https://avatars.discourse-cdn.com/v4/letter/e/9d8465/32.png) [@esoth](https://community.naturalcapitalalliance.org/u/esoth)\
**Post date:** [March 10, 2021, 5:45pm UTC](https://community.naturalcapitalalliance.org/t/watersheds-shapefile-related-error-annual-water-yield-invest-3-9-0/1753/2 "2021-03-10T17:45:12Z")

</div>

Hi @denzilroy,  
It looks like the original error is `Points of LinearRing do not form a closed linestring`. There’s almost certainly something wrong with your geometry, but it’s strange that the geometry checker wouldn’t catch it. If you zoom in to the vertices, sometimes one of them doesn’t line up perfectly and the lines intersect instead, which isn’t allowed. If you’re still stuck, feel free to send me your data and I can look into it. You can upload it here or share it privately by email: esoth @ stanford.edu

---

<div class="post-metadata">

**Author:** ![dave](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/dave/32/70_2.png) [@dave](https://community.naturalcapitalalliance.org/u/dave)\
**Post date:** [March 10, 2021, 10:12pm UTC](https://community.naturalcapitalalliance.org/t/watersheds-shapefile-related-error-annual-water-yield-invest-3-9-0/1753/3 "2021-03-10T22:12:31Z")

</div>

> [@denzilroy](#):
>
> QGIS3 using the Topology Checker plugin for the rule “must not have invalid geometry”.

I’m not familiar with this plugin, but I’ve had luck using the built-in Vector menu \> Geometry Tools \> Check Validity tool from QGIS. It has a “Method: GEOS” option for the topology rules, which is useful because shapely should be following the same GEOS rules.

I’ve also had luck with the “buffer by 0” trick. Could be worth a try.

---

<div class="post-metadata">

**Author:** ![denzilroy](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/denzilroy/32/957_2.png) [@denzilroy](https://community.naturalcapitalalliance.org/u/denzilroy)\
**Post date:** [March 26, 2021, 7:22am UTC](https://community.naturalcapitalalliance.org/t/watersheds-shapefile-related-error-annual-water-yield-invest-3-9-0/1753/4 "2021-03-26T07:22:36Z")

</div>

Thank you @dave and @esoth for responding with suggestions.

@dave, I tried the built-in check validity tool, and Method: GEOS, but the output did not show up an error. I also tried the “buffer by 0” trick, and it worked. I used the Grass module “v.buffer”, set buffer distance to 0 in map units, and left all other options at default. Now the water yield model was able to run without errors. Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex031/uploads/naturalcapitalproject/original/2X/8/8d95591aa074da87ea0fdd61ca47c1c3c0588aa7.png) [@system](https://community.naturalcapitalalliance.org/u/system)\
**Post date:** [April 2, 2021, 7:23am UTC](https://community.naturalcapitalalliance.org/t/watersheds-shapefile-related-error-annual-water-yield-invest-3-9-0/1753/5 "2021-04-02T07:23:16Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
