Switch to using a url_template and attribution in config
This commit is contained in:
parent
dc5914080c
commit
fe0910bd39
2 changed files with 7 additions and 6 deletions
|
@ -1,5 +1,6 @@
|
||||||
stadiamaps:
|
osm:
|
||||||
api_key:
|
url_template: https://tile.openstreetmap.org/{z}/{x}/{y}.png
|
||||||
|
attribution: © OpenStreetMap
|
||||||
nominatim:
|
nominatim:
|
||||||
api_base_url:
|
api_base_url:
|
||||||
mastodon:
|
mastodon:
|
||||||
|
|
8
scl.py
8
scl.py
|
@ -27,7 +27,8 @@ except requests.JSONDecodeError:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
config = yaml.safe_load(open("config.yml"))
|
config = yaml.safe_load(open("config.yml"))
|
||||||
stadiamaps_api_key = config["stadiamaps"]["api_key"]
|
osm_url_template = config["osm"]["url_template"]
|
||||||
|
osm_attribution = config["osm"]["attribution"]
|
||||||
nominatim_url = config["nominatim"]["api_base_url"]
|
nominatim_url = config["nominatim"]["api_base_url"]
|
||||||
mastodon_client = Mastodon(
|
mastodon_client = Mastodon(
|
||||||
client_id=config["mastodon"]["client_id"],
|
client_id=config["mastodon"]["client_id"],
|
||||||
|
@ -39,7 +40,7 @@ mastodon_client = Mastodon(
|
||||||
|
|
||||||
class AttribStaticMap(staticmap.StaticMap, object):
|
class AttribStaticMap(staticmap.StaticMap, object):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.attribution = "© Stadia Maps © OpenMapTiles © OpenStreetMap"
|
self.attribution = osm_attribution
|
||||||
super(AttribStaticMap, self).__init__(*args, **kwargs)
|
super(AttribStaticMap, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
def _draw_features(self, image):
|
def _draw_features(self, image):
|
||||||
|
@ -132,8 +133,7 @@ def do_initial_post(
|
||||||
map = AttribStaticMap(
|
map = AttribStaticMap(
|
||||||
1024,
|
1024,
|
||||||
1024,
|
1024,
|
||||||
url_template="https://tiles.stadiamaps.com/tiles/outdoors/{z}/{x}/{y}@2x.png?api_key="
|
url_template=osm_url_template,
|
||||||
+ stadiamaps_api_key,
|
|
||||||
tile_size=512,
|
tile_size=512,
|
||||||
)
|
)
|
||||||
assert event["polygons"]["type"] == "polygon"
|
assert event["polygons"]["type"] == "polygon"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue