Road
We can create a topologically connected road network for a given area from OpenStreetMap (OSM) data. The resulting network can be annotated with data retrieved from OSM (e.g. highway classification, surface type), along with data looked up from user-supplied sources (e.g. rehabilitation costs).
Description
- Download or copy
.osm.pbf
file to input data directory. - Filter OSM file with
osmium tags-filter
for elements matching the filter file (see configuration, below). - Define a bounding box for the OSM file, write to disk as JSON.
- Define a grid partitioning the bounding box into a square number of 'slices' as a series of JSON files, one for each slice.
- Cut the OSM file into these slices.
- Convert the sliced OSM files into geoparquet, retaining the
keep_tags
as configured. - Clean and annotate features in the geoparquet files (joining additional data such as country, rehabiliation costs, etc.).
- Join sliced network components together.
Configuration
To specify a desired network:
- Review and amend the spreadsheets in
bundled_data/transport
, these supply information that is used to gap-fill or extend what can be determined from OSM alone. - Review and amend
config/config.yaml
:- The
infrastructure_datasets
map should contain a key pointing to an.osm.pbf
file URL for desired area. There are currently entries for the planet, for (some definition of) continents and several countries. We use the geofabrik service for continent and country-level OSM extracts. - Check the OSM filter file pointed to by
network_filters.road
. This file specifies which elements (nodes, ways or relations) to keep (or reject) from the multitude of data in an OSM file. See the filter expressions section here for more information on the syntax of these files. - Check and amend
keep_tags.road
. This list of strings specifies whichtags
(attributes) to retain on the filtered elements we extract from the.osm.pbf
file. - Review
slice_count
. This controls the degree of parallelism possible. With it set to 1, there is no spatial slicing (we create the network in a single chunk). To speed network creation for large domains, it can be set to a larger square number. The first square number greater than your number of available CPUs is a good heuristic. - Check and amend the values of
transport.road
, which provide some defaults for OSM data gap-filling.
- The
Creation
And to create the network, by way of example:
snakemake --cores all -- results/egypt-latest_filter-road/edges.geoparquet