Repository navigation
v0.11.0
[v0.11.0] - 2026-11-03
Added
-
Road networks from OpenStreetMap (
gigaspatial/fetchers/osm/roads.py)OSMRoadsFetcherfetches the road network of a source (a country, a geometry, a frame, or points) through osmnx and the Overpass API, and returns aSpatialNetwork. Points become their convex hull, bounding box, or buffers, widened bybuffermeters. List-valued OSM attributes are normalised so the network can be saved.- Failed requests are retried with growing pauses, and the last error suggests an Overpass mirror. Areas above 50,000 km² log a warning.
- New setting
OVERPASS_URLchooses the Overpass endpoint.
-
Country-scale road networks from Geofabrik's extracts (
gigaspatial/handlers/osm/)OSMRoadsHandlerdownloads Geofabrik's OpenStreetMap extracts and builds the sameSpatialNetworkthatOSMRoadsFetcherreturns for the same area, tested against osmnx for every network type. It reads an extract once with pyosmium, without osmnx or networkx: Rwanda's network builds in 15 s, where the route through osmnx took 300 s. Once stored, the whole country loads in under a second.- A country uses its own extract whole, or its regional extracts with
regions=True; a country that shares an extract, such as Singapore, is cut from it along its boundary. Any other source uses the smallest extracts that cover its area and is cropped to it as the fetcher would, joining extracts as if they were one file.extracts=names extracts directly; continents are used only when named. - Extracts are stored by date in Geofabrik's own folders, checked against Geofabrik's checksums, with each network type's network saved beside its extract. The newest stored extract is used offline;
refresh,max_age_days, anddatechoose another. A network's metadata records its extract's ID, date, URL, and replication timestamp. crop_to_sourcedefaults toTruefor this handler.
-
Spatial networks (
gigaspatial/processing/network/)SpatialNetworkholds nodes and edges as two tables, not as a networkx graph, with lengths in meters computed as osmnx does. Every edit returns a new network. Build one from a networkx or osmnx graph, from points joined to their nearest neighbours, or from tables.insert_pointsjoins points such as schools to their nearest road in one batch, splitting each road once at all of its points. On Rwanda's roads it inserts 10,000 points in 1.8 s.- Shortest path lengths and routes, nodes reachable within a distance, nearest targets by road, counts within a distance, connected components, minimum spanning trees, and links between disconnected parts, on scipy's sparse graph routines, with pandana as an optional backend.
simplifyremoves nodes that only continue a road, with the same result as osmnx and 22 times faster on unsimplified Rwanda.connecting_subnetworkkeeps only the roads that join a set of points: a Steiner tree, each point's path to its nearest root, or the paths between every pair.ConnectionPlannerplans how to connect points such as schools to an existing network such as fibre at the smallest shared cost. The existing network's nodes are roots, joined to one virtual root, so the plan is a Steiner tree in which a school may connect through another school: 4,037 km for 1,000 schools and 20 roots on Rwanda's roads, where each school's path to its nearest root takes 5,802 km, in 0.19 s. AConnectionPlanholds the contracted network, the chosen road edges, the cost, and each terminal's status, root, and distance along the plan.bridge_costlets a plan use straight-line links, such as microwave links, between parts of the network that no road joins, at a weight per metre and up tobridge_max_distance. A plan uses a link only where it is cheaper than the roads; bridges are edges of kindbridge, and each terminal'sbridgedsays whether its path crosses one.method="shortest_path", the default, models a phased rollout: terminals are connected one at a time, nearest first, to everything connected so far, and each gets itsorderandmarginal_cost. 10,000 schools on Rwanda's roads take 4.4 s.improve(plan)shortens a plan by local search, with Uchoa and Werneck's key-path exchange and key-vertex elimination, and never makes it worse. On Rwanda's roads with 1,000 schools it saves 4.7% on the Steiner tree and 32% on the nearest-root paths, at about 5 s per pass;time_limitstops it early.lower_bound(plan)computes a lower bound on any plan's cost by Wong's dual ascent, and sets the plan'sboundandgap, so every plan can say how far from the optimum it can be at most. On Rwanda's roads it takes 5 s for 1,000 schools and 41 s for 10,000, and shows the improved plans within 1.4% and 0.6% of the optimum.- Validated against exact optima: on Kigali's roads, solved exactly with scipy's
milp, improved plans were within 0.86% of the optimum and the bound within 1.1%; on SteinLib's test sets B to E, within 2.2% and 0.42% on average.benchmarks/connection_planning/holds the benchmarks. saveandloadstore a network as a folder of Parquet files that GIS tools, DuckDB, and pandas read directly.to_networkxandto_pandanaconvert it for other libraries.
-
GloFAS flood hazard handler (
gigaspatial/handlers/glofas.py)GlofasHandlerloads Copernicus EMS flood maps for a country or a geometry. One load fetches one layer (depth,depth_reclass,permanent_water, orspurious_depth) and, for the depth layers, one return period (default 100).- Tiles come from the published
tile_extents.geojson. Stored paths include the layer and, for depth layers, the return period. Mask layers reject an explicitreturn_period.
-
Optional extras.
giga-spatial[roads]installs osmnx forOSMRoadsFetcherand pyosmium forOSMRoadsHandler.giga-spatial[pandana]installs pandana forSpatialNetwork.to_pandanaandbackend="pandana". Both are part ofgiga-spatial[all].
Changed
-
Source geometry shared by handlers and fetchers (
gigaspatial/handlers/base/config.py)- The body of
BaseHandlerConfig.extract_search_geometrymoved into the functionsource_geometry, which the method calls. Handler behaviour is unchanged.
- The body of
-
OpenStreetMap fetchers grouped in
gigaspatial/fetchers/osm/OSMLocationFetchermoved fromgigaspatial/fetchers/osm.pytogigaspatial/fetchers/osm/pois.py, besideOSMRoadsFetcherinroads.py, as the OSM handler is grouped ingigaspatial/handlers/osm/.from gigaspatial import OSMLocationFetcher,from gigaspatial.fetchers import OSMLocationFetcher, andfrom gigaspatial.fetchers.osm import OSMLocationFetcherall still work.
-
Download checksums (
gigaspatial/handlers/base/fetch.py)stream_to_storetakesmd5=, checked while the file streams; on a mismatch the file is removed andValueErrorraised.
-
.pbfpaths (gigaspatial/handlers/base/source.py)- A string ending in
.pbf, such as"rwanda-latest.osm.pbf", is now a path source; before, it was taken for a country name.
- A string ending in
Fixed
- WorldPop catalog errors (
gigaspatial/handlers/worldpop.py)WorldPopRestClient.get_datasetsretries connection errors, timeouts, truncated responses, responses that are not JSON, and HTTP 429, 500, 502, 503, and 504. If the catalog request still fails, that error is raised. A failed request is no longer reported as "No WorldPop datasets found".
Documentation
- A road networks guide, with a section on whole countries, an API page for spatial networks,
OSMRoadsFetcheron the fetchers page,OSMRoadsHandleron the handlers page, and the list of optional extras on the installation page. - A spatial networks concept note, and a design and algorithm decisions document for the network, the OSM roads handler, and connection planning.
- Five design decisions: ADR 0004, why a spatial network is held as tables; ADR 0005, how a saved network is laid out; ADR 0006, how OSM extracts and their networks are stored; ADR 0007, how extracts are chosen for a source; and ADR 0008, why connecting points to an existing network is a rooted Steiner tree.
- Docs and package descriptions now cover the datasets and zone types the library ships, including road networks and GloFAS, and the docs template carries a Google Search Console verification tag.