osm

The central module containing all code dealing with importing OSM data.

This module either directly contains the code dealing with importing OSM data, or it re-exports everything needed to handle it. Please refrain from importing code from any modules below this one, because it might lead to unwanted behaviour.

If you have to import code from a module below this one because the code isn’t exported from this module, please file a bug, so we can fix this.

class OpenStreetMap(dependencies)[source]

Bases: egon.data.datasets.Dataset

Downloads OpenStreetMap data from Geofabrik and writes it to database.

Dependencies
Resulting Tables
  • openstreetmap.osm_line is created and filled (table has no associated python class)
  • openstreetmap.osm_nodes is created and filled (table has no associated python class)
  • openstreetmap.osm_point is created and filled (table has no associated python class)
  • openstreetmap.osm_polygon is created and filled (table has no associated python class)
  • openstreetmap.osm_rels is created and filled (table has no associated python class)
  • openstreetmap.osm_roads is created and filled (table has no associated python class)
  • openstreetmap.osm_ways is created and filled (table has no associated python class)

See documentation section OpenStreetMap for more information.

name = 'OpenStreetMap'
version = '0.0.4'
add_metadata()[source]

Writes metadata JSON string into table comment.

download()[source]

Download OpenStreetMap .pbf file.

modify_tables()[source]

Adjust primary keys, indices and schema of OSM tables.

  • The Column “id” is added and used as the new primary key.
  • Indices (GIST, GIN) are reset
  • The tables are moved to the schema configured as the “output_schema”.
to_postgres(cache_size=4096)[source]

Import OSM data from a Geofabrik .pbf file into a PostgreSQL database.

Parameters:cache_size (int, optional) – Memory used during data import