|
| SWMM_ENGINE_API SWMM_Gpkg | swmm_gpkg_open (const char *path) |
| | Open an existing GeoPackage file.
|
| |
| SWMM_ENGINE_API void | swmm_gpkg_close (SWMM_Gpkg gpkg) |
| | Close the GeoPackage and free all resources.
|
| |
| SWMM_ENGINE_API const char * | swmm_gpkg_last_error (SWMM_Gpkg gpkg) |
| | Get the last error message.
|
| |
| SWMM_ENGINE_API int | swmm_gpkg_begin (SWMM_Gpkg gpkg) |
| | Begin a transaction for bulk operations.
|
| |
| SWMM_ENGINE_API int | swmm_gpkg_commit (SWMM_Gpkg gpkg) |
| | Commit the current transaction.
|
| |
| SWMM_ENGINE_API int | swmm_gpkg_rollback (SWMM_Gpkg gpkg) |
| | Roll back the current transaction.
|
| |
| SWMM_ENGINE_API int | swmm_gpkg_register (const char *license_key, const char *organization, const char *contact_email, const char *deployment_id) |
| | Register the GeoPackage plugin.
|
| |
| SWMM_ENGINE_API int | swmm_gpkg_is_registered (void) |
| | Check whether the GeoPackage plugin is registered.
|
| |
| SWMM_ENGINE_API int | swmm_gpkg_simulation_count (SWMM_Gpkg gpkg) |
| | Get the number of simulation runs in the GeoPackage.
|
| |
| SWMM_ENGINE_API int | swmm_gpkg_simulation_id (SWMM_Gpkg gpkg, int index, char *buf, int bufsz) |
| | Get the simulation_id at the given index.
|
| |
| SWMM_ENGINE_API int | swmm_gpkg_node_count (SWMM_Gpkg gpkg, const char *simulation_id) |
| |
| SWMM_ENGINE_API int | swmm_gpkg_link_count (SWMM_Gpkg gpkg, const char *simulation_id) |
| |
| SWMM_ENGINE_API int | swmm_gpkg_subcatch_count (SWMM_Gpkg gpkg, const char *simulation_id) |
| |
| SWMM_ENGINE_API int | swmm_gpkg_gage_count (SWMM_Gpkg gpkg, const char *simulation_id) |
| |
| SWMM_ENGINE_API int | swmm_gpkg_topology_edge_count (SWMM_Gpkg gpkg, const char *simulation_id) |
| |
| SWMM_ENGINE_API int | swmm_gpkg_variable_count (SWMM_Gpkg gpkg) |
| |
| SWMM_ENGINE_API int | swmm_gpkg_read_result_ts (SWMM_Gpkg gpkg, const char *simulation_id, const char *object_type, const char *object_id, const char *variable_name, double *times, double *values, int max_count) |
| | Read a result timeseries for one object and variable.
|
| |
| SWMM_ENGINE_API int | swmm_gpkg_result_ts_count (SWMM_Gpkg gpkg, const char *simulation_id, const char *object_type, const char *object_id, const char *variable_name) |
| | Get the number of result timeseries records for a query.
|
| |
| SWMM_ENGINE_API int | swmm_gpkg_read_summary (SWMM_Gpkg gpkg, const char *simulation_id, const char *object_type, const char *object_id, const char *variable_name, double *value) |
| | Read a single summary statistic value.
|
| |
| SWMM_ENGINE_API int | swmm_gpkg_create_observed_series (SWMM_Gpkg gpkg, const char *name, const char *variable_name, const char *object_type, const char *object_id, const char *source, const char *units) |
| | Create an observed data series.
|
| |
| SWMM_ENGINE_API int | swmm_gpkg_write_observed_value (SWMM_Gpkg gpkg, int series_id, const char *timestamp, double value, const char *quality_flag) |
| | Write a single observed data point.
|
| |
| SWMM_ENGINE_API int | swmm_gpkg_write_observed_values (SWMM_Gpkg gpkg, int series_id, const char **timestamps, const double *values, const char **quality_flags, int count) |
| | Bulk-write a vector of observed data points to a series.
|
| |
| SWMM_ENGINE_API int | swmm_gpkg_observed_series_count (SWMM_Gpkg gpkg) |
| | Get the number of observed series in the GeoPackage.
|
| |
| SWMM_ENGINE_API int | swmm_gpkg_observed_value_count (SWMM_Gpkg gpkg, int series_id) |
| | Get the number of values in an observed series.
|
| |
| SWMM_ENGINE_API int | swmm_gpkg_read_observed_values (SWMM_Gpkg gpkg, int series_id, char *timestamps, int ts_buf_len, double *values, int max_count) |
| | Read observed timeseries values into caller-supplied arrays.
|
| |
| SWMM_ENGINE_API int | swmm_gpkg_query_int (SWMM_Gpkg gpkg, const char *sql) |
| | Execute a read-only SQL query and get the first integer result.
|
| |
| SWMM_ENGINE_API int | swmm_gpkg_query_double (SWMM_Gpkg gpkg, const char *sql, double *result) |
| | Execute a read-only SQL query and get the first double result.
|
| |
OpenSWMM Engine — GeoPackage C API.
Provides a C89-compatible API for interacting with GeoPackage files produced by the OpenSWMM engine. The API has two modes:
Read-only access to model definitions, simulation results, and summary statistics. These are written by the engine's plugin system (GeoPackageInputPlugin, GeoPackageOutputPlugin, GeoPackageReportPlugin) and are not modifiable through this C API.
Read-write access to observed / sensor timeseries data. This API is designed for calibration and comparison workflows: import measured data from external sources, associate it with model objects, and query it alongside simulation results.
Transactions are available for bulk operations. Wrapping observed data imports in a transaction (swmm_gpkg_begin / swmm_gpkg_commit) can improve insert performance by 10-100x.
This header is only available when compiled with OPENSWMM_WITH_GEOPACKAGE=ON. Link against openswmm_geopackage.
Usage:
double values[100];
double times[100];
"depth", times, values, 100);
"flow", "LINK", "C1", "USGS", "CMS");
double ts_vals[] = {1.5, 2.3, 1.8};
const char* ts_times[] = {"2026-01-15T08:00:00Z",
"2026-01-15T09:00:00Z",
"2026-01-15T10:00:00Z"};
OpenSWMM Engine — GeoPackage C API.
void * SWMM_Gpkg
Opaque handle to an open GeoPackage database.
Definition openswmm_geopackage.h:75
SWMM_ENGINE_API int swmm_gpkg_node_count(SWMM_Gpkg gpkg, const char *sim_id)
Definition openswmm_geopackage_impl.cpp:182
SWMM_ENGINE_API void swmm_gpkg_close(SWMM_Gpkg gpkg)
Close the GeoPackage and free all resources.
Definition openswmm_geopackage_impl.cpp:86
SWMM_ENGINE_API SWMM_Gpkg swmm_gpkg_open(const char *path)
Open an existing GeoPackage file.
Definition openswmm_geopackage_impl.cpp:66
SWMM_ENGINE_API int swmm_gpkg_create_observed_series(SWMM_Gpkg gpkg, const char *name, const char *variable_name, const char *object_type, const char *object_id, const char *source, const char *units)
Create an observed data series.
Definition openswmm_geopackage_impl.cpp:318
SWMM_ENGINE_API int swmm_gpkg_write_observed_values(SWMM_Gpkg gpkg, int series_id, const char **timestamps, const double *values, const char **quality_flags, int count)
Bulk-write a vector of observed data points to a series.
Definition openswmm_geopackage_impl.cpp:382
SWMM_ENGINE_API int swmm_gpkg_begin(SWMM_Gpkg gpkg)
Begin a transaction for bulk operations.
Definition openswmm_geopackage_impl.cpp:103
SWMM_ENGINE_API int swmm_gpkg_commit(SWMM_Gpkg gpkg)
Commit the current transaction.
Definition openswmm_geopackage_impl.cpp:114
SWMM_ENGINE_API int swmm_gpkg_read_result_ts(SWMM_Gpkg gpkg, const char *simulation_id, const char *object_type, const char *object_id, const char *variable_name, double *times, double *values, int max_count)
Read a result timeseries for one object and variable.
Definition openswmm_geopackage_impl.cpp:249
- Author
- Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
- Copyright
- Copyright (c) 2026 Caleb Buahin. All rights reserved.
- License\n MIT License