Repo for non destructive e-scooter intervention materials
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

90 lines
2.6 KiB

import folium
import requests
import json
import subprocess
#create map object
m = folium.Map(location=[52.516190, 13.377693], tiles='Stamen Toner',zoom_start=13)
#make api request (writes api responses to json)
subprocess.call(['sh','./scooter_locations.sh'])
#import scooter1 data
with open('scooter1.json', 'r') as scooter_location:
location_data=scooter_location.read()
#print(location_data)
location_data_json = json.loads(location_data)
#print(location_data_json)
lat = location_data_json['data']['attributes']['lat']
#print(lat)
lng = location_data_json['data']['attributes']['lng']
#print(lng)
#create markers for scooter1
folium.Marker([lat,lng],
popup='<strong>ARTIST_NAME + ARTWORK_TITLE<strong/>',
tooltip='ARTIST_NAME_HERE',
icon=folium.Icon(icon='cloud')).add_to(m)
#import scooter2 data
with open('scooter2.json', 'r') as scooter_location:
location_data=scooter_location.read()
location_data_json = json.loads(location_data)
lat = location_data_json['data']['attributes']['lat']
lng = location_data_json['data']['attributes']['lng']
#create markers for scooter2
folium.Marker([lat,lng],
popup='<strong>ARTIST_NAME + ARTWORK_TITLE<strong/>',
tooltip='ARTIST_NAME_HERE',
icon=folium.Icon(icon='cloud')).add_to(m)
#import scooter3 data
with open('scooter3.json', 'r') as scooter_location:
location_data=scooter_location.read()
location_data_json = json.loads(location_data)
lat = location_data_json['data']['attributes']['lat']
lng = location_data_json['data']['attributes']['lng']
#create markers for scooter3
folium.Marker([lat,lng],
popup='<strong>ARTIST_NAME + ARTWORK_TITLE<strong/>',
tooltip='ARTIST_NAME_HERE',
icon=folium.Icon(icon='cloud')).add_to(m)
#import scooter4 data
with open('scooter4.json', 'r') as scooter_location:
location_data=scooter_location.read()
location_data_json = json.loads(location_data)
lat = location_data_json['data']['attributes']['lat']
lng = location_data_json['data']['attributes']['lng']
#create markers for scooter4
folium.Marker([lat,lng],
popup='<strong>ARTIST_NAME + ARTWORK_TITLE<strong/>',
tooltip='ARTIST_NAME_HERE',
icon=folium.Icon(icon='cloud')).add_to(m)
#import scooter5 data
with open('scooter5.json', 'r') as scooter_location:
location_data=scooter_location.read()
location_data_json = json.loads(location_data)
lat = location_data_json['data']['attributes']['lat']
lng = location_data_json['data']['attributes']['lng']
#create markers for scooter2
folium.Marker([lat,lng],
popup='<strong>ARTIST_NAME + ARTWORK_TITLE<strong/>',
tooltip='ARTIST_NAME_HERE',
icon=folium.Icon(icon='cloud')).add_to(m)
#generate map.html
m.save('map.html')