Coastal Vulnerability: AttributeError: 'NoneType' object has no attribute 'IsValid'

Hi all!

I’ve been trying to use the Coastal Vulnerability model but currently faced with this error: AttributeError: ‘NoneType’ object has no attribute ‘IsValid’. Seems to be the one of my vectors (Mangrove) but I am not entirely sure.

Here are the data: final_data - Google Drive

Appreciate all feedbacks and help.

Thank you!

Attach the logfile here:

InVEST-natcap.invest.coastal_vulnerability-log-2023-02-03–13_12_39.txt (3.1 KB)

Welcome to the forum, @iKonig!

Thanks for posting the log file and data. If you look earlier in the log file, there’s this message:

2023-02-03 13:12:39,623 (natcap.invest.coastal_vulnerability) coastal_vulnerability.search_for_vector_habitat(2048) INFO Searching for Mangrove within 500 meters of shore points
2023-02-03 13:12:39,702 (taskgraph.Task) Task.add_task(706) ERROR Something went wrong when adding task searching for Mangrove

So I’m guessing that the issue is that the model is not finding any Mangrove within 500 meters of your landmass. And when I look at your inputs, indeed that seems to be the case. You have a lot of polygons in your landmass, and a lot of Mangroves, but your area of interest polygon only covers a very small area, and there are no Mangroves anywhere near it.

~ Stacie

Ah, I thought so! Thank you very much @swolny for your time and effort to check. Also, if that’s the case, what do you recommend to do in this case? Do I have to make the value lower?

Really appreciate your help. Thanks!

This is indeed a problem! Though technically the model hit this error before it finished searching for the Mangroves. I think the error is caused by an empty feature in the Mangrove layer. In other words, there is a row in the attribute table that has no associated polygon. Deleting that feature should resolve this.

Thank you for your comment! You’re right, I deleted some of the empty features and it works perfectly now.

1 Like

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