Skip to content

Convert OpenStreetMap (OSM) data to RDF Turtle, including the object geometries and all their DE-9IM spatial relations. Weekly updated dumps for the whole planet (~ 200 billion triples) and for each country.

License

Notifications You must be signed in to change notification settings

ad-freiburg/osm2rdf

Repository files navigation

osm2rdf

osm2rdf is a tool for converting OpenStreetMap (OSM) data to RDF Turtle (TTL).

It also pre-computes the spatial relations sfIntersects, sfContains, sfCovers, sfTouches, sfCrosses, sfOverlaps, and sfEquals between all OSM objects.

Services and materials

Weekly updated downloads for the complete OSM as well as for individual countries are provided here.

A SPARQL endpoint (based on the QLever SPARQL engine) for the complete OSM data is available under https://qlever.dev/osm-planet. Example: all buildings under a powerline. The UI provides more example queries (click "Examples").

The basic method behind osm2rdf is described in this SIGSPATIAL'21 paper.

The methods behind computing the spatial relations are described in this SIGSPATIAL'25 paper.

Requirements

  • cmake
  • Compiler for C++17
  • libexpat1
  • zlib
  • libbz2
  • libomp (optional, for multithreading)

Quickstart

Fetch this repo:

$ git clone https://github.com/ad-freiburg/osm2rdf.git

Build osm2rdf:

$ cd osm2rdf
$ mkdir -p build && cd build
$ cmake ..
$ make -j

Fetch an OSM input file and print TTL to stdout:

$ wget https://download.geofabrik.de/europe/germany/baden-wuerttemberg/freiburg-regbez-latest.osm.pbf
$ ./apps/osm2rdf freiburg-regbex-latest.osm.pbf

For more options, see --help, -h, -hh, and -hhh.

Docker

Alternatively you may use the provided Dockerfile to compile and run osm2rdf:

$ docker build -t osm2rdf .
$ mkdir input
$ wget -O input/freiburg-regbez-latest.osm.pbf https://download.geofabrik.de/europe/germany/baden-wuerttemberg/freiburg-regbez-latest.osm.pbf
$ docker run -v `pwd`/input/:/input/ -it osm2rdf /input/freiburg-regbex-latest.osm.pbf

About

Convert OpenStreetMap (OSM) data to RDF Turtle, including the object geometries and all their DE-9IM spatial relations. Weekly updated dumps for the whole planet (~ 200 billion triples) and for each country.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 6