Add default tile layer in case it is not defined

This commit is contained in:
Antonia 2024-09-06 23:44:41 +02:00
parent 2f0ac6bb76
commit f413db0fac

View file

@ -25,9 +25,12 @@ config = {}
config["name"] = properties["name"]
colors = {}
config["layers"] = colors
config["tilelayer"] = properties["tilelayer"]
if "tilelayer" in properties and properties['tilelayer'] != {} :
config["tilelayer"] = properties["tilelayer"]
config["tilelayer"]["attribution"] = re.sub(r'\[\[([^|]+)\|([^|]+)\]\]', r'<a href="\1" >\2</a>', config["tilelayer"]["attribution"])
else :
config["tilelayer"] = { "attribution" : 'Map data © <a href="http://osm.org/copyright" >OpenStreetMap contributors</a>', "url_template" : "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" }
def normalize_name(name) :
return name.replace("/", "_").replace("-","").replace(" ","").replace(".","")