wielka-wyspa/wielka-wyspa.py

132 lines
2.8 KiB
Python

# Wrocław / Wielka Wyspa / Hackerspace w prettymaps
# https://github.com/marceloprates/prettymaps
import osmnx as ox
import prettymaps
import matplotlib.pyplot as plt
COLOR_HS = "#fdb515"
COLOR_HS_LIGHT = "#ffecc3"
COLOR_WATER = "#1fa1f8"
COLOR_BLACK = "#000000"
COLOR_WHITE = "#ffffff"
PAGE_SIZES = {
"A6": (5.83, 4.13),
"A5": (8.27, 5.83),
"A4": (11.69, 8.27),
"Square": (8.27, 8.27),
"A3": (16.54, 11.69),
"A2": (23.39, 16.54),
"A1": (33.11, 23.39),
}
ox.settings.use_cache = True
ox.settings.cache_folder = "/tmp/.cache/osmnx"
prettymaps.create_preset(
"wielka-wyspa",
layers = {
"perimeter": {},
"streets": {
"width": {
"trunk": 3,
"primary": 2.5,
"secondary": 2,
"tertiary": 1.5,
"residential": 0.5,
"pedestrian": 0.5,
"footway": 0.5,
"path": 0.5
}
},
"building": {
"tags": {
"building": True,
"leisure": [
"track",
"pitch"
]
}
},
"water": {
"tags": {
"natural": [
"water",
"bay"
]
}
},
},
style = {
"background": {
"fill": True,
"fc": COLOR_WATER,
"lw": 0,
# "hatch": "---",
"zorder": -1
},
"perimeter": {
"fill": True,
"fc": COLOR_HS_LIGHT,
"lw": 0.5,
"zorder": 0
},
"water": {
"fill": True,
"fc": COLOR_WATER,
"lw": 0,
"zorder": 1
},
"streets": {
"fc": "#000000",
"ec": "#ffffff",
"lw": 0,
"zorder": 3
},
"building": {
"palette": [
COLOR_HS
],
"ec": "#000000",
"lw": 0.5,
"zorder": 4
}
}
)
osm_credit={
"text": "Data © OpenStreetMap contributors\ngithub.com/marceloprates/prettymaps",
"x": 0.03,
"y": 0.03,
"horizontalalignment": "left",
"verticalalignment": "bottom",
"fontsize": 6,
"fontfamily" : "Ubuntu",
"fontname": "Ubuntu Mono",
"color" : COLOR_BLACK,
"bbox": {
# "boxstyle": "round,pad=0.35",
# "fc": "black",
# "ec": COLOR_HS,
"lw": 0,
"alpha": 0.0,
},
}
plot = prettymaps.plot(
'Wielka Wyspa',
# 'Czasoprzestrzeń',
dilate = 0,
figsize = PAGE_SIZES["A2"],
preset = 'wielka-wyspa',
credit = osm_credit,
show = True,
adjust_aspect_ratio = False,
)