Skip to content

Destatis German administrative units as hierarchical Ruby objects

License

Notifications You must be signed in to change notification settings

pludoni/ruby-destatis_regionen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Destatis Region / Kreise / Gemeinde

Parses the offical document from Destatis and provides convenient Ruby access to all the administrative regions in Germany

Download "Auszug_GV.xlsx" from here: https://www.destatis.de/DE/Themen/Laender-Regionen/Regionales/Gemeindeverzeichnis/Administrativ/Archiv/GVAuszugJ/31122020_Auszug_GV.html;jsessionid=014EDECCFE584E09F79555744B3AE367.live721

Parse:

parser = Destatis::AuszugGvParser.new("./31122020_Auszug_GV.xlsx")
# might take a couple of seconds
parser.run

# now you have all state regierungsbezirk kreis and gemeinde:

Destatis::State.all
Destatis::Regierungsbezirk.all
Destatis::Kreis.all
Destatis::Gemeinde.all

# and interlinking

Destatis::Gemeinde['Rüsselsheim'].kreis.regierungsbezirk.state == Destatis::State['Hessen']

Afterwards you can serialize to json and load on other program runs with improves loading drastically:

# once
parser = Destatis::AuszugGvParser.new("./31122020_Auszug_GV.xlsx")
parser.run
Destatis::Loader.save(target = 'GEM_PATH/data/regions.json')


# on each subsequent run:
Destatis::Loader.load(source = 'GEM_PATH/data/regions.json')

About

Destatis German administrative units as hierarchical Ruby objects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published