generate_network_from_bbox
Build a water network from OSM roads in a bounding box: derive junctions/pipes from streets, place reservoir at river, sample DEM elevations, and produce a validated EPANET model.
Instructions
Build a water network automatically from real streets — the one-call GIS layout (roadmap Phase 4, native tool). Fetch OSM highway+waterway ways for a bbox (or reuse a saved extract via osmExtract/osmFile), derive the junction/pipe skeleton: the connected component containing the road nearest the river, dead-end spurs pruned (minDeadEndM, default 30 m), roads decimated to ~spacingM (default 150 m) junction spacing, and pipe diameters from the road class as HDPE (PE100) INTERNAL bores at SDR 11 — e.g. trunk 290, primary 258, secondary 205, tertiary 164, residential 90, service 74 mm — with the default pipe material HDPE (Hazen-Williams C = 130). The reservoir is placed at the nearest OSM waterway point to river and connected to the nearest junction by an intake pipe; ground elevations are sampled from the bundled IFSAR 10 m DEM (never guessed, same fail-closed contract as create_network elevationSource). The resulting model is engine-validated and becomes a normal session (networkId): run_simulation, assign_demands, optimize_network and save_network all work on it immediately. The bbox mode calls the public Overpass API (fixed endpoint, 30 s timeout, 25 MB response cap); pass osmExtract or osmFile instead to work from a saved extract with no network. Provide exactly one of bbox / osmExtract / osmFile, plus river and a positive reservoirHead (the intake/pump discharge head — a design input, never guessed).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bbox | No | Bounding box (WGS84) to fetch OSM highway+waterway ways from Overpass. Provide exactly one of bbox / osmExtract / osmFile. | |
| river | Yes | The water source: the reservoir is placed at the nearest OSM waterway point to this coordinate (falling back to the coordinate itself when the extract has no waterways). | |
| title | No | Model title; defaults to 'Auto-layout network'. | |
| osmFile | No | A saved OSM extract JSON file (with an 'elements' array), relative to the server data directory. Provide exactly one of bbox / osmExtract / osmFile. | |
| spacingM | No | Target junction spacing along roads (m); default 150. Lower = more junctions, higher = a coarser skeleton. | |
| osmExtract | No | Inline OSM elements (Overpass 'out body' JSON) to lay out instead of fetching live. Provide exactly one of bbox / osmExtract / osmFile. | |
| minDeadEndM | No | Dead-end chains shorter than this (m) are pruned; default 30. 0 keeps every dead-end branch. | |
| reservoirHead | Yes | Reservoir head in the model's length units (e.g. meters) — the intake/pump discharge head. Required; never guessed. |