Recreation Model -> AttributeError: 'NoneType' object has no attribute 'ExportToWkt'

Hi there,
I’m trying to run the Recreation Model with the Compute Regression option, and get the following error:
AttributeError: ‘NoneType’ object has no attribute ‘ExportToWkt’

I am using the latest Mac release, and have already successfully used the Recreation Model without the option Compute Regression. All predictor shapefiles (12) are in the same coordinate system (EPSG:3763). I have also tried with just one predictor, to make sure there was no issue with one of the files, but the result is the same.

Here is the log file: InVEST-Recreation-Model-log-2020-01-15–10_38_19.txt (1.9 KB)

Any help would be much appreciated!
Thanks!

Hi there,

This error actually happened while checking the projection of the AOI shapefile. So it is worth double-checking that the AOI has a coordinate system defined.

I also think this model may have been unstable in the specific release you are using. For this model, I would recommend either using the official 3.7.0 release, or updating to the latest development build for Mac OS here:
releases.naturalcapitalproject.org/invest/3.7.0.post839+h89ab3f9d1349.d20200108/InVEST-3.7.0.post839+h89ab3f9d1349.d20200108-mac.zip

Thanks @dave, I think the AOI file was also on the same coordinate system, but will check!
I will try the latest development build then (I’m also interested on the Urban models, and the official 3.7.0 release does not include them yet, at least for Mac). If it doesn’t work, I will try the official release. Will give feedback as soon as possible.

Hi Dave,

I seem to be having a similar issue with my model run. My 4 predictor variables are in the same projection (4269) along with AOI vector (4269).

Any recommendations? Is it possible that my predictor table ‘type’ columns are not correct (should be line_intersect_length vs. polygon_area_coverage)?

InVEST-Visitation-Recreation-and-Tourism-log-2022-01-23–11_27_28.txt (1.7 KB)

We’re resolving this by email. Will post a solution here when we have one.

Hi Dave,

I am also facing the same problem, do you have any updates on the solution?

Here is my log file:
InVEST-Recreation-Model-log-2022-03-06–17_06_48.txt (9.5 KB)

Dear Dave,

I am unfortunately also having the same issue :

AttributeError: ‘NoneType’ object has no attribute ‘ExportToWkt’

Please find my log file if you could please assist on that:
InVEST-natcap.invest.recreation.recmodel_client-log-2022-08-17–14_22_50.txt (2.0 KB)

I look forward to hearing from you.

Best regards,
Cathleen

Hi @Cathleen,

It could be that one of paths under the path column in the predictor CSV is not properly pointing to a file. Could you share that predictor csv and / or say if you’re using relative paths there or full paths?

Thanks,

Doug

Dear Doug,

Thank you very much for your quick feedback. I am indeed awaiting for your response since I am very new on InVEST. Following your comments, I made some modifications on the full paths in the predictor table. I ran the model once more with the attached predictor table and the model result’s having the same "AttributeError: ‘NoneType’ object has no attribute ‘ExportToWkt’

Please find the log file and the predictor tabel:

InVEST-natcap.invest.recreation.recmodel_client-log-2022-08-19–14_08_52.txt (2.0 KB)

Predictor table.csv (514 Bytes)

Could you please provide with further solutions or recommendations.

I stay at your disposal for more information.

Best regards,
Cathleen

Thanks for sharing that information @Cathleen. It looks like the CSV is okay and that the model is loading the paths correctly. Given the location of the error it also seems like the shapefile is being opened okay, it just doesn’t have a valid layer.

Would you mind zipping up your predictor shapefiles and attaching them here? You can also share them via Dropbox, Google Drive, or another cloud sharing service.

Thanks!

Dear @dcdenu4,

Please find the following links

https://drive.google.com/drive/folders/1NPzyaQmc00kL-C4hEbo7Ka9K9igtEChA?usp=sharing
https://drive.google.com/drive/folders/1TgxQ3X4wfvG7WEQKhCg-4KL6B_I2NO1V?usp=sharing

I stay at your disposal for further information.

Best regards,
Cathleen

1 Like

Hi @Cathleen , thank you for sharing those data. I see that many of the shapefiles are missing their .prj file. That is the file that contains information about the projection and coordinate system. I’m fairly certain that is the cause of this error.

Maybe you have the missing file somewhere? Or maybe if you load the shapefile into GIS, you can define the coordinate system (assuming you know what it should be) and then save/export as a new shapefile. Then the .prj file will be created.

1 Like

Bonjour Dev,

Greetings from Réunion Island, thank you for your feedback. Indeed I made the necessary corrections to generate the .prj files and while testing I received the following results, which we believe there is perhaps some gaps in the data? What are your thoughts?:

InVEST-natcap.invest.recreation.recmodel_client-log-2022-09-01–14_51_22.txt (6.6 KB)

However, I tested by adding a supplementary bigger shape file of Réunion, and the software has been running overnight without stopping with the following log messages but the log file is too big to be uploaded to send :

2022-09-01 15:51:08,212 (natcap.invest.utils) utils.prepare_workspace(162) Level 100 Writing log messages to [S:\SERVICE_INNOV\2022\MOVE-ON\Mare Longue\InVest\1_directory\InVEST-natcap.invest.recreation.recmodel_client-log-2022-09-01–15_51_08.txt]
2022-09-01 15:51:08,214 (main) cli.main(475) Level 100 Starting model with parameters:
Arguments for InVEST natcap.invest.recreation.recmodel_client 3.11.0:
aoi_path S:\SERVICE_INNOV\2022\MOVE-ON\Mare Longue\InVest\2_ Area of interest\New folder\test.shp
cell_size 10
compute_regression True
end_year 2017
grid_aoi True
grid_type square
n_workers -1
predictor_table_path S:\SERVICE_INNOV\2022\MOVE-ON\Mare Longue\InVest\3_predictor_table_f\Predictor table.csv
results_suffix
scenario_predictor_table_path
start_year 2005
workspace_dir S:\SERVICE_INNOV\2022\MOVE-ON\Mare Longue\InVest\1_directory

2022-09-01 15:51:08,628 (py.warnings) warnings._showwarnmsg(109) WARNING natcap\invest\utils.py:630: FutureWarning: The squeeze argument has been deprecated and will be removed in a future version. Append .squeeze(“columns”) to the call to squeeze.

2022-09-01 15:51:10,509 (natcap.invest.recreation.recmodel_client) recmodel_client._grid_vector(592) INFO gridding aoi
2022-09-01 16:30:35,361 (osgeo) utils._log_gdal_errors(98) WARNING [errno 1] 2GB file size limit reached for S:\SERVICE_INNOV\2022\MOVE-ON\Mare Longue\InVest\1_directory\intermediate\aoi.shp. Going on, but might cause compatibility issues with third party software
2022-09-01 17:14:10,978 (osgeo) utils._log_gdal_errors(98) ERROR [errno 1] Failed to write shape object. File size cannot reach 4294967276 + 136.
2022-09-01 17:14:10,979 (osgeo) utils._log_gdal_errors(98) ERROR [errno 1] Failed to write shape object. File size cannot reach 4294967276 + 136.
2022-09-01 17:14:10,980 (osgeo) utils._log_gdal_errors(98) ERROR [errno 1] Failed to write shape object. File size cannot reach 4294967276 + 136.

I look forward to hearing from you.

Best regards,
Cathleen

Bonjour @dave ,

Greetings from Réunion Island, thank you for your feedback. Indeed I made the necessary corrections to generate the .prj files and while testing I received the following results, which we believe there is perhaps some gaps in the data? What are your thoughts?:

InVEST-natcap.invest.recreation.recmodel_client-log-2022-09-01–14_51_22.txt (6.6 KB)

However, I tested by adding a supplementary bigger shape file of Réunion, and the software has been running overnight without stopping with the following log messages but the log file is too big to be uploaded to send :

2022-09-01 15:51:08,212 (natcap.invest.utils) utils.prepare_workspace(162) Level 100 Writing log messages to [S:\SERVICE_INNOV\2022\MOVE-ON\Mare Longue\InVest\1_directory\InVEST-natcap.invest.recreation.recmodel_client-log-2022-09-01–15_51_08.txt]
2022-09-01 15:51:08,214 (main) cli.main(475) Level 100 Starting model with parameters:
Arguments for InVEST natcap.invest.recreation.recmodel_client 3.11.0:
aoi_path S:\SERVICE_INNOV\2022\MOVE-ON\Mare Longue\InVest\2_ Area of interest\New folder\test.shp
cell_size 10
compute_regression True
end_year 2017
grid_aoi True
grid_type square
n_workers -1
predictor_table_path S:\SERVICE_INNOV\2022\MOVE-ON\Mare Longue\InVest\3_predictor_table_f\Predictor table.csv
results_suffix
scenario_predictor_table_path
start_year 2005
workspace_dir S:\SERVICE_INNOV\2022\MOVE-ON\Mare Longue\InVest\1_directory

2022-09-01 15:51:08,628 (py.warnings) warnings._showwarnmsg(109) WARNING natcap\invest\utils.py:630: FutureWarning: The squeeze argument has been deprecated and will be removed in a future version. Append .squeeze(“columns”) to the call to squeeze.

2022-09-01 15:51:10,509 (natcap.invest.recreation.recmodel_client) recmodel_client._grid_vector(592) INFO gridding aoi
2022-09-01 16:30:35,361 (osgeo) utils._log_gdal_errors(98) WARNING [errno 1] 2GB file size limit reached for S:\SERVICE_INNOV\2022\MOVE-ON\Mare Longue\InVest\1_directory\intermediate\aoi.shp. Going on, but might cause compatibility issues with third party software
2022-09-01 17:14:10,978 (osgeo) utils._log_gdal_errors(98) ERROR [errno 1] Failed to write shape object. File size cannot reach 4294967276 + 136.
2022-09-01 17:14:10,979 (osgeo) utils._log_gdal_errors(98) ERROR [errno 1] Failed to write shape object. File size cannot reach 4294967276 + 136.
2022-09-01 17:14:10,980 (osgeo) utils._log_gdal_errors(98) ERROR [errno 1] Failed to write shape object. File size cannot reach 4294967276 + 136.

I look forward to hearing from you.

Best regards,
Cathleen
[/quote]

Hi @Cathleen ,

Yes, there is a technical limit to how large ESRI Shapefiles can be. In this case, your workarounds are to either increase the cell size, reduce the area of your AOI, or both. This should also speed up the runtime as well.

Let us know how this goes!
James

1 Like

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