A template for loading a noded OSM street network data into PostGIS — and start editing right away
To learn more about the editing capabilities, please check out my 2023 FOSS4G presentation about editing pgRouting topologies.
Note: for now, this is only tested on Linux and may or may not work on macOS. Accepting pull requests for a Windows/Powershell port of the setup script :-)
To start editing your OSM extract of choice, you need to follow these steps:
- Clone this repository:
git clone [email protected]:chrstnbwnkl/cosmetics.git
- Make sure you have osm4routing installed. For this, install the
rust
programming language and then install usingcargo install osm4routing
- Have an OSM pbf file ready (get yours here!)
- Run the
setup
script from the project root directory pointing to your OSM file and giving the tables a name:./setup /path/to/OSM.pbf berlin
This will create the table creation, import and editing scripts. Now you have two options:
- create a PostGIS Docker container using the
docker-compose.yml
(rundocker compose up -d
), the scripts will be loaded automatically - use the created
import.sh
script to load the scripts into any PostgreSQL instance, using the same connection arguments as withplsql
:./import.sh -h <host> -p <port> -d <db> -U <user>
After successfully loading the scripts into PostGIS you can connect QGIS to that data base and start editing!
Note: when editing in QGIS, make sure to set the filter
"topo_removed" = false
for both the edge and node table, so that removed elements are not shown in QGIS.
At the time of initial development this is nothing but a proof of concept, so issues and PR's are welcome!