vg250

The central module containing all code dealing with VG250 data.

This module either directly contains the code dealing with importing VG250 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 Vg250(dependencies)[source]

Bases: egon.data.datasets.Dataset

Obtains and processes VG250 data and writes it to database.

Original data is downloaded using download_files() function and written to database using to_postgres() function.

Dependencies
No dependencies
Resulting tables
filename = 'https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip'
name = 'VG250'
version = 'https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip-0.0.4'
add_metadata()[source]

Writes metadata JSON string into table comment.

cleaning_and_preperation()[source]

Creates tables and MViews with cleaned and corrected geometry data.

The following table is created:
  • boundaries.vg250_gem_clean where municipalities (Gemeinden) that are fragmented are cleaned from ringholes
The following MViews are created:
  • boundaries.vg250_gem_hole
  • boundaries.vg250_gem_valid
  • boundaries.vg250_krs_area
  • boundaries.vg250_lan_union
  • boundaries.vg250_sta_bbox
  • boundaries.vg250_sta_invalid_geometry
  • boundaries.vg250_sta_tiny_buffer
  • boundaries.vg250_sta_union
download_files()[source]

Download VG250 (Verwaltungsgebiete) shape files.

Data is downloaded from source specified in datasets.yml in section vg250/original_data/source/url and saved to file specified in vg250/original_data/target/file.

nuts_mview()[source]

Creates MView boundaries.vg250_lan_nuts_id.

to_postgres()[source]

Writes original VG250 data to database.

Creates schema boundaries if it does not yet exist. Newly creates all tables specified as keys in datasets.yml in section vg250/processed/file_table_map.

vg250_metadata_resources_fields()[source]

Returns metadata string for VG250 tables.