Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Spanish communities #203

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions pyrosm/data/geofabrik.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
nordrhein_wesfalen_url = "europe/germany/nordrhein-westfalen/"
poland_url = "europe/poland/"
russia_url = "russia/"
spain_url = "europe/spain/"
usa_url = "north-america/us/"


Expand Down Expand Up @@ -1147,6 +1148,7 @@ def __init__(self):
"netherlands",
"poland",
"russia",
"spain"
"usa",
]
available = self.regions
Expand All @@ -1162,6 +1164,7 @@ def __init__(self):
self.netherlands = Netherlands()
self.poland = Poland()
self.russia = Russia()
self.spain = Spain()
self.usa = USA()

self.available = {name: self.__dict__[name].available for name in self.regions}
Expand All @@ -1171,3 +1174,50 @@ def __getattr__(self, name):

def __call__(self):
return self.available

class Spain:
regions = [
"Andalucía",
"Aragón",
"Asturias",
"Cantabria",
"Castilla-La Mancha",
"Castilla y León",
"Cataluña",
"Ceuta",
"Extremadura",
"Galicia",
"Islas Baleares",
"La Rioja",
"Madrid",
"Melilla",
"Murcia",
"Navarra",
"País Vasco",
"Valencia",
]

available = regions
available.sort()

country = {
"name": "spain" + suffix,
"url": URL + europe_url + "spain" + suffix,
}

# Create data sources
_sources = {
region: {
"name": region.replace("_", "-") + suffix,
"url": URL + spain_url + region.replace("_", "-") + suffix,
}
for region in regions
}

__dict__ = _sources

def __getattr__(self, name):
return self.__dict__[name]

def __call__(self):
return self.available