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

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