Skip to content

v0.11.0

Choose a tag to compare

@utkucanozturk utkucanozturk released this 03 Nov 13:56
· 129 commits to main since this release
2ce9406

[v0.11.0] - 2026-11-03

Added

  • Road networks from OpenStreetMap (gigaspatial/fetchers/osm/roads.py)

    • OSMRoadsFetcher fetches the road network of a source (a country, a geometry, a frame, or points) through osmnx and the Overpass API, and returns a SpatialNetwork. Points become their convex hull, bounding box, or buffers, widened by buffer meters. 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_URL chooses the Overpass endpoint.
  • Country-scale road networks from Geofabrik's extracts (gigaspatial/handlers/osm/)

    • OSMRoadsHandler downloads Geofabrik's OpenStreetMap extracts and builds the same SpatialNetwork that OSMRoadsFetcher returns 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, and date choose another. A network's metadata records its extract's ID, date, URL, and replication timestamp.
    • crop_to_source defaults to True for this handler.
  • Spatial networks (gigaspatial/processing/network/)

    • SpatialNetwork holds 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_points joins 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.
    • simplify removes nodes that only continue a road, with the same result as osmnx and 22 times faster on unsimplified Rwanda. connecting_subnetwork keeps 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.
    • ConnectionPlanner plans 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. A ConnectionPlan holds the contracted network, the chosen road edges, the cost, and each terminal's status, root, and distance along the plan.
    • bridge_cost lets 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 to bridge_max_distance. A plan uses a link only where it is cheaper than the roads; bridges are edges of kind bridge, and each terminal's bridged says 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 its order and marginal_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_limit stops it early.
    • lower_bound(plan) computes a lower bound on any plan's cost by Wong's dual ascent, and sets the plan's bound and gap, 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.
    • save and load store a network as a folder of Parquet files that GIS tools, DuckDB, and pandas read directly. to_networkx and to_pandana convert it for other libraries.
  • GloFAS flood hazard handler (gigaspatial/handlers/glofas.py)

    • GlofasHandler loads Copernicus EMS flood maps for a country or a geometry. One load fetches one layer (depth, depth_reclass, permanent_water, or spurious_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 explicit return_period.
  • Optional extras. giga-spatial[roads] installs osmnx for OSMRoadsFetcher and pyosmium for OSMRoadsHandler. giga-spatial[pandana] installs pandana for SpatialNetwork.to_pandana and backend="pandana". Both are part of giga-spatial[all].

Changed

  • Source geometry shared by handlers and fetchers (gigaspatial/handlers/base/config.py)

    • The body of BaseHandlerConfig.extract_search_geometry moved into the function source_geometry, which the method calls. Handler behaviour is unchanged.
  • OpenStreetMap fetchers grouped in gigaspatial/fetchers/osm/

    • OSMLocationFetcher moved from gigaspatial/fetchers/osm.py to gigaspatial/fetchers/osm/pois.py, beside OSMRoadsFetcher in roads.py, as the OSM handler is grouped in gigaspatial/handlers/osm/. from gigaspatial import OSMLocationFetcher, from gigaspatial.fetchers import OSMLocationFetcher, and from gigaspatial.fetchers.osm import OSMLocationFetcher all still work.
  • Download checksums (gigaspatial/handlers/base/fetch.py)

    • stream_to_store takes md5=, checked while the file streams; on a mismatch the file is removed and ValueError raised.
  • .pbf paths (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.

Fixed

  • WorldPop catalog errors (gigaspatial/handlers/worldpop.py)
    • WorldPopRestClient.get_datasets retries 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, OSMRoadsFetcher on the fetchers page, OSMRoadsHandler on 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.