opencoil-paracity/website/Speedshow_Map.py

23 lines
496 B
Python
Raw Normal View History

2020-09-02 22:39:37 +02:00
import folium
import requests
2020-09-02 22:54:09 +02:00
import json
2020-09-02 22:39:37 +02:00
2020-09-02 22:54:09 +02:00
#import scooter data
2020-09-02 22:39:37 +02:00
2020-09-02 22:54:09 +02:00
with open('1scooter.json') as file:
data = json.load(file)
lat = data['data']['attributes']['lat']
lng = data['data']['attributes']['lng']
2020-09-02 22:39:37 +02:00
#create map object
2020-09-02 23:01:16 +02:00
m = folium.Map(location=[52.516190, 13.377693], zoom_start=13)
2020-09-02 22:39:37 +02:00
#create markers
2020-09-02 22:54:09 +02:00
folium.Marker([lat,lng],
2020-09-02 23:01:16 +02:00
popup='<strong>ARTIST_NAME + ARTWORK_TITLE<strong/>',
tooltip='ARTIST_NAME_HERE',
2020-09-02 22:39:37 +02:00
icon=folium.Icon(icon='cloud')).add_to(m)
#generate map.html
m.save('map.html')