Visitation model: "OGR Error: Corrupt data" in transform_bounding_box on the server (InVEST 3.20.2)

Hi all,

I am running Visitation: Recreation and Tourism in InVEST 3.20.2 on macOS for a small AOI in Singapore (a 6 × 6 km square around Mandai). My settings are: start year 2012, end year 2017, grid the AOI = True, grid type = hexagon, cell size = 1000 m, compute regression = False.

The client connects to the server, but every run fails on the server side with “RuntimeError: OGR Error: Corrupt data”. The traceback points to recmodel_server.py, line 551 (_calc_aggregated_points_in_aoi):

global_b_box = pygeoprocessing.transform_bounding_box(local_b_box, aoi_info[‘projection_wkt’], lat_lng_ref.ExportToWkt())

The error is raised at target_ref.ImportFromWkt(target_projection_wkt) in pygeoprocessing. As far as I can tell, the WKT that fails to import is the target lat/lng reference created on the server, not the projection of my AOI.

What I have tried:

  • AOI as a GeoPackage in EPSG:3414 (SVY21 / Singapore TM), 22 Oct 2026
  • AOI as a GeoPackage in EPSG:32648 (WGS 84 / UTM zone 48N), 22 Oct 2026
  • The same run again, 23 Oct 2026

All three runs gave the same error. The failing task runs in a server workspace under server/twitter/local/…, so the problem may be specific to the Twitter (TUD) part.

The first lines of my log read:

paste the lines starting with "Contacting server", "AOI accepted" and "twitter server supports" here

Could you please check whether this is a server-side issue? If the Twitter part is the cause, is there a way to obtain the Flickr PUD results on their own in the meantime?

The full log is below. Thank you very much for your help.

Aria

2026-10-23 12:25:14,441 (natcap.invest.utils) utils.prepare_workspace(166) Level 100 Writing log messages to [/Users/lyu/Desktop/PHD时期/05. Course/Urban NbS/final/ES7030_Mandai/runs/visitation/InVEST-recreation-log-2026-10-23--12_25_14.txt]
2026-10-23 12:25:14,442 (natcap.invest.spec) spec.execute(2603) Level 100 Starting model with parameters: 
Arguments for InVEST recreation 3.20.2:
aoi_path           /Users/lyu/Desktop/PHD时期/05. Course/Urban NbS/final/ES7030_Mandai/data/mandai_aoi_6km_utm.gpkg
cell_size          1000
compute_regression False
end_year           2017
grid_aoi           True
grid_type          hexagon
n_workers          -1
results_suffix     hex1000
start_year         2012
workspace_dir      /Users/lyu/Desktop/PHD时期/05. Course/Urban NbS/final/ES7030_Mandai/runs/visitation

2026-10-23 12:25:14,447 (urllib3.connectionpool) connectionpool._new_conn(241) DEBUG Starting new HTTP connection (1): data.naturalcapitalproject.org:80
2026-10-23 12:25:14,752 (urllib3.connectionpool) connectionpool._make_request(544) DEBUG http://data.naturalcapitalproject.org:80 "GET /server_registry/invest_recreation_model_3_19_0/index.html HTTP/1.1" 200 48
2026-10-23 12:25:14,753 (natcap.invest.recreation.recmodel_client) recmodel_client.execute(540) INFO PYRO:natcap.invest.recreation@34.56.65.180:54323
2026-10-23 12:25:14,755 (natcap.invest.recreation.recmodel_client) recmodel_client._retrieve_user_days(712) INFO Contacting server, please wait.
2026-10-23 12:25:15,505 (natcap.invest.recreation.recmodel_client) recmodel_client._retrieve_user_days(730) INFO flickr server supports year queries between 2005 and 2017
2026-10-23 12:25:16,326 (natcap.invest.recreation.recmodel_client) recmodel_client._retrieve_user_days(750) INFO AOI accepted. Fewer than 1271246 flickr points found within AOI extent: [103.77068943788754, 1.3840833355301707, 103.81340392606766, 1.4311060051248774]
2026-10-23 12:25:16,540 (natcap.invest.recreation.recmodel_client) recmodel_client._retrieve_user_days(730) INFO twitter server supports year queries between 2012 and 2022
2026-10-23 12:25:17,032 (natcap.invest.recreation.recmodel_client) recmodel_client._retrieve_user_days(750) INFO AOI accepted. Fewer than 33411853 twitter points found within AOI extent: [103.77068943788754, 1.3840833355301707, 103.81340392606766, 1.4311060051248774]
2026-10-23 12:25:17,037 (natcap.invest.recreation.recmodel_client) recmodel_client._retrieve_user_days(756) INFO archiving /Users/lyu/Desktop/PHD时期/05. Course/Urban NbS/final/ES7030_Mandai/runs/visitation/intermediate/aoi_hex1000.gpkg
2026-10-23 12:25:17,039 (natcap.invest.recreation.recmodel_client) recmodel_client._retrieve_user_days(765) INFO Please wait for server to calculate PUD and TUD...
2026-10-23 12:25:24,538 (PUD) recmodel_server.calc_user_days_in_aoi(442) INFO decompress zip file AOI
2026-10-23 12:25:24,543 (PUD) recmodel_server.calc_user_days_in_aoi(453) INFO running calc user days on /usr/local/recreation-server/invest_3_15_0/server/flickr/local/9688c4e1-69bc-4c6b-8123-13377d4a4fa7
2026-10-23 12:25:24,603 (TUD) recmodel_server.calc_user_days_in_aoi(442) INFO decompress zip file AOI
2026-10-23 12:25:24,610 (TUD) recmodel_server.calc_user_days_in_aoi(453) INFO running calc user days on /usr/local/recreation-server/invest_3_15_0/server/twitter/local/1787c398-fe3e-4049-94fe-085fc89d2634
2026-10-23 12:25:25,535 (natcap.invest.recreation.recmodel_client) recmodel_client._retrieve_user_days(790) INFO connection release
2026-10-23 12:25:25,535 (natcap.invest.recreation.recmodel_client) recmodel_client._retrieve_user_days(799) ERROR concurrent.futures.process._RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/local/recreation-server/invest_3_15_0/invest_3_19_0/env/lib/python3.13/concurrent/futures/process.py", line 254, in _process_worker
    r = call_item.fn(*call_item.args, **call_item.kwargs)
  File "/usr/local/recreation-server/invest_3_15_0/invest_3_19_0/src/natcap/invest/recreation/recmodel_server.py", line 455, in calc_user_days_in_aoi
    self._calc_aggregated_points_in_aoi(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        aoi_path, workspace_path, start_year, end_year,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        target_filename, logger))
        ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/recreation-server/invest_3_15_0/invest_3_19_0/src/natcap/invest/recreation/recmodel_server.py", line 551, in _calc_aggregated_points_in_aoi
    global_b_box = pygeoprocessing.transform_bounding_box(
        local_b_box, aoi_info['projection_wkt'], lat_lng_ref.ExportToWkt())
  File "/usr/local/recreation-server/invest_3_15_0/invest_3_19_0/env/lib/python3.13/site-packages/pygeoprocessing/utils.py", line 32, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/recreation-server/invest_3_15_0/invest_3_19_0/env/lib/python3.13/site-packages/pygeoprocessing/geoprocessing.py", line 3652, in transform_bounding_box
    target_ref.ImportFromWkt(target_projection_wkt)
    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/recreation-server/invest_3_15_0/invest_3_19_0/env/lib/python3.13/site-packages/osgeo/osr.py", line 1703, in ImportFromWkt
    return _osr.SpatialReference_ImportFromWkt(self, *args)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
RuntimeError: OGR Error: Corrupt data
"""
.
The above exception was the direct cause of the following exception:

.Traceback (most recent call last):
.  File "/usr/local/recreation-server/invest_3_15_0/invest_3_19_0/src/natcap/invest/recreation/recmodel_server.py", line 205, in calculate_userdays
    results[label] = future.result()
                     ~~~~~~~~~~~~~^^
.  File "/usr/local/recreation-server/invest_3_15_0/invest_3_19_0/env/lib/python3.13/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ~~~~~~~~~~~~~~~~~^^
.  File "/usr/local/recreation-server/invest_3_15_0/invest_3_19_0/env/lib/python3.13/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
.RuntimeError: OGR Error: Corrupt data

2026-10-23 12:25:25,536 (taskgraph.Task) Task.add_task(716) ERROR Something went wrong when adding task user-day-calculation (1), terminating taskgraph.
Traceback (most recent call last):
  File "taskgraph/Task.py", line 684, in add_task
  File "taskgraph/Task.py", line 1103, in _call
  File "natcap/invest/recreation/recmodel_client.py", line 800, in _retrieve_user_days
RuntimeError: An error occurred on the server.
2026-10-23 12:25:25,539 (natcap.invest.utils) utils.prepare_workspace(171) ERROR Exception while executing recreation
Traceback (most recent call last):
  File "natcap/invest/utils.py", line 169, in prepare_workspace
  File "natcap/invest/spec.py", line 2609, in execute
  File "natcap/invest/recreation/recmodel_client.py", line 563, in execute
  File "taskgraph/Task.py", line 684, in add_task
  File "taskgraph/Task.py", line 1103, in _call
  File "natcap/invest/recreation/recmodel_client.py", line 800, in _retrieve_user_days
RuntimeError: An error occurred on the server.
2026-10-23 12:25:25,541 (natcap.invest.utils) utils.prepare_workspace(174) INFO Elapsed time: 11.1s
2026-10-23 12:25:25,541 (natcap.invest.utils) utils.prepare_workspace(177) INFO Execution finished; version: 3.20.2

@a260008 , thank you for reporting this issue. It seems like something was corrupt on the server. We have switched over to a new server and things should work as expected now. Please try again, thanks!