|
NGen
|
Reads a hydrofabric stored as a pair of GeoJSON files. More...
#include <GeoJSONHydrofabricReader.hpp>
Inheritance diagram for ngen::hydrofabric::GeoJSONHydrofabricReader:
Collaboration diagram for ngen::hydrofabric::GeoJSONHydrofabricReader:Public Member Functions | |
| GeoJSONHydrofabricReader (std::string divides_path, std::string nexus_path) | |
| geojson::GeoJSON | read_divides (const std::vector< std::string > &ids={}) override |
| Read the hydrofabric's divides. | |
| geojson::GeoJSON | read_nexus (const std::vector< std::string > &ids={}) override |
| Read the hydrofabric's nexuses. | |
Private Attributes | |
| const std::string | divides_path_ |
| const std::string | nexus_path_ |
Reads a hydrofabric stored as a pair of GeoJSON files.
This is the original hydrofabric format, and the reason the drivers take two data paths: the divides and the nexuses were always separate files. There is no schema version to detect and nothing to translate – GeoJSON hydrofabrics carry "id" and "toid" as ordinary feature properties – so this reader is a thin pass-through to geojson::read().
That last point is an assumption, not a check: this reader translates nothing, so it reads only the "id"/"toid" vocabulary that HydrofabricVersion::V1_GEOJSON names. GeoJSON exported from a later hydrofabric would carry that release's column names instead – divide_id, nexus_id, flowpath_toid – and would load with empty feature ids rather than being refused. Nothing in ngen produces such files today; supporting them would mean identifying a release from GeoJSON content, which no caller currently needs.
| ngen::hydrofabric::GeoJSONHydrofabricReader::GeoJSONHydrofabricReader | ( | std::string | divides_path, |
| std::string | nexus_path ) |
| [in] | divides_path | Path to the GeoJSON file holding the divides |
| [in] | nexus_path | Path to the GeoJSON file holding the nexuses; may name the same file |
|
overridevirtual |
Read the hydrofabric's divides.
| [in] | ids | Optional subset of divide IDs to capture; if empty, all divides are read. IDs that the hydrofabric does not contain are silently ignored, so the result is the intersection of the hydrofabric and ids. |
| std::runtime_error | if the divides cannot be read |
Implements ngen::hydrofabric::HydrofabricReader.
References divides_path_, and geojson::read().
|
overridevirtual |
Read the hydrofabric's nexuses.
| [in] | ids | Optional subset of nexus IDs to capture; if empty, all nexuses are read. IDs that the hydrofabric does not contain are silently ignored. |
| std::runtime_error | if the nexuses cannot be read |
Implements ngen::hydrofabric::HydrofabricReader.
References nexus_path_, and geojson::read().
|
private |
Referenced by read_divides().
|
private |
Referenced by read_nexus().