29 lines
835 B
Python
29 lines
835 B
Python
import folium
|
|
import requests
|
|
import json
|
|
import subprocess
|
|
|
|
#make api request
|
|
|
|
out1 = subprocess.Popen(["curl", "https://platform.tier-services.io/v1/vehicle/f6f55778-9339-4f81-8584-7645f3a6c4be", "-H", "x-api-key: bpEUTJEBTf74oGRWxaIcW7aeZMzDDODe1yBoSxi2"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
|
stdout, stderr = out1.communicate()
|
|
request_scooter1 = stdout
|
|
|
|
print(request_scooter1)
|
|
|
|
#import scooter data
|
|
|
|
lat = request_scooter1['data']['attributes']['lat']
|
|
lng = request_scooter1['data']['attributes']['lng']
|
|
|
|
#create map object
|
|
m = folium.Map(location=[52.516190, 13.377693], tiles='Stamen Toner',zoom_start=13)
|
|
|
|
#create markers
|
|
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') |