diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..8de20ff Binary files /dev/null and b/.DS_Store differ diff --git a/website/Scooters/scooter1.json b/website/Scooters/scooter1.json index c19646c..2213e11 100644 --- a/website/Scooters/scooter1.json +++ b/website/Scooters/scooter1.json @@ -1 +1 @@ -{"data":{"type":"vehicle","id":"fbd739d6-554f-4eaf-bd9c-afe3d501c94b","attributes":{"state":"ACTIVE","lastLocationUpdate":"2020-10-07T17:42:16Z","lastStateChange":"2020-10-07T15:09:13Z","batteryLevel":70,"lat":52.505015,"lng":13.358382,"maxSpeed":20,"zoneId":"BERLIN","code":272581,"iotVendor":"okai","licencePlate":"115MZJ","isRentable":true,"vehicleType":"escooter","hasHelmetBox":true,"hasHelmet":true}}} \ No newline at end of file +{"data":{"type":"vehicle","id":"fbd739d6-554f-4eaf-bd9c-afe3d501c94b","attributes":{"state":"ACTIVE","lastLocationUpdate":"2020-10-08T16:45:11Z","lastStateChange":"2020-10-07T15:09:13Z","batteryLevel":59,"lat":52.504926,"lng":13.358061,"maxSpeed":20,"zoneId":"BERLIN","code":272581,"iotVendor":"okai","licencePlate":"115MZJ","isRentable":true,"vehicleType":"escooter","hasHelmetBox":true,"hasHelmet":true}}} \ No newline at end of file diff --git a/website/Scooters/scooter10.json b/website/Scooters/scooter10.json index cc56df2..821df43 100644 --- a/website/Scooters/scooter10.json +++ b/website/Scooters/scooter10.json @@ -1 +1 @@ -{"data":{"type":"vehicle","id":"8732f342-df2f-475f-b0f6-c0032743a944","attributes":{"state":"ACTIVE","lastLocationUpdate":"2020-10-07T17:40:09Z","lastStateChange":"2020-10-05T22:40:24Z","batteryLevel":63,"lat":52.523244,"lng":13.485684,"maxSpeed":20,"zoneId":"BERLIN","code":285124,"iotVendor":"okai","licencePlate":"502MZT","isRentable":true,"vehicleType":"escooter","hasHelmetBox":true,"hasHelmet":false}}} \ No newline at end of file +{"data":{"type":"vehicle","id":"8732f342-df2f-475f-b0f6-c0032743a944","attributes":{"state":"ACTIVE","lastLocationUpdate":"2020-10-08T16:43:04Z","lastStateChange":"2020-10-08T13:20:54Z","batteryLevel":52,"lat":52.513734,"lng":13.477419,"maxSpeed":20,"zoneId":"BERLIN","code":285124,"iotVendor":"okai","licencePlate":"502MZT","isRentable":true,"vehicleType":"escooter","hasHelmetBox":true,"hasHelmet":false}}} \ No newline at end of file diff --git a/website/Scooters/scooter2.json b/website/Scooters/scooter2.json index 0e1e843..ce01924 100644 --- a/website/Scooters/scooter2.json +++ b/website/Scooters/scooter2.json @@ -1 +1 @@ -{"data":{"type":"vehicle","id":"530b66c9-e5f9-47ac-ba31-2e357dc4c735","attributes":{"state":"ACTIVE","lastLocationUpdate":"2020-10-07T17:41:22Z","lastStateChange":"2020-10-06T21:00:11Z","batteryLevel":97,"lat":52.461337,"lng":13.32099,"maxSpeed":20,"zoneId":"BERLIN","code":285232,"iotVendor":"okai","licencePlate":"291MZT","isRentable":true,"vehicleType":"escooter","hasHelmetBox":true,"hasHelmet":false}}} \ No newline at end of file +{"data":{"type":"vehicle","id":"530b66c9-e5f9-47ac-ba31-2e357dc4c735","attributes":{"state":"ACTIVE","lastLocationUpdate":"2020-10-08T16:49:40Z","lastStateChange":"2020-10-06T21:00:11Z","batteryLevel":91,"lat":52.461132,"lng":13.321118,"maxSpeed":20,"zoneId":"BERLIN","code":285232,"iotVendor":"okai","licencePlate":"291MZT","isRentable":true,"vehicleType":"escooter","hasHelmetBox":true,"hasHelmet":false}}} \ No newline at end of file diff --git a/website/Scooters/scooter3.json b/website/Scooters/scooter3.json index ebc3f56..ee9aac3 100644 --- a/website/Scooters/scooter3.json +++ b/website/Scooters/scooter3.json @@ -1 +1 @@ -{"data":{"type":"vehicle","id":"aa9cedf8-ab8e-4651-8b43-93079179f26a","attributes":{"state":"ACTIVE","lastLocationUpdate":"2020-10-07T17:43:51Z","lastStateChange":"2020-10-06T13:26:05Z","batteryLevel":95,"lat":52.521088,"lng":13.353991,"maxSpeed":20,"zoneId":"BERLIN","code":284748,"iotVendor":"okai","licencePlate":"893MZT","isRentable":true,"vehicleType":"escooter","hasHelmetBox":true,"hasHelmet":false}}} \ No newline at end of file +{"data":{"type":"vehicle","id":"aa9cedf8-ab8e-4651-8b43-93079179f26a","attributes":{"state":"ACTIVE","lastLocationUpdate":"2020-10-08T16:42:16Z","lastStateChange":"2020-10-06T13:26:05Z","batteryLevel":52,"lat":52.487742,"lng":13.42546,"maxSpeed":20,"zoneId":"BERLIN","code":284748,"iotVendor":"okai","licencePlate":"893MZT","isRentable":true,"vehicleType":"escooter","hasHelmetBox":true,"hasHelmet":false}}} \ No newline at end of file diff --git a/website/Scooters/scooter4.json b/website/Scooters/scooter4.json index d0d3d61..f273475 100644 --- a/website/Scooters/scooter4.json +++ b/website/Scooters/scooter4.json @@ -1 +1 @@ -{"data":{"type":"vehicle","id":"9df16c74-4a88-4f21-acf5-12ba401ca15a","attributes":{"state":"ACTIVE","lastLocationUpdate":"2020-10-07T17:37:53Z","lastStateChange":"2020-10-07T06:37:12Z","batteryLevel":93,"lat":52.478558,"lng":13.419809,"maxSpeed":20,"zoneId":"BERLIN","code":279035,"iotVendor":"okai","licencePlate":"838MZJ","isRentable":true,"vehicleType":"escooter","hasHelmetBox":true,"hasHelmet":false}}} \ No newline at end of file +{"data":{"type":"vehicle","id":"9df16c74-4a88-4f21-acf5-12ba401ca15a","attributes":{"state":"ACTIVE","lastLocationUpdate":"2020-10-08T16:43:21Z","lastStateChange":"2020-10-08T10:32:34Z","batteryLevel":100,"lat":52.475104,"lng":13.419081,"maxSpeed":20,"zoneId":"BERLIN","code":279035,"iotVendor":"okai","licencePlate":"838MZJ","isRentable":true,"vehicleType":"escooter","hasHelmetBox":true,"hasHelmet":false}}} \ No newline at end of file diff --git a/website/Scooters/scooter5.json b/website/Scooters/scooter5.json index ef700e1..b323d63 100644 --- a/website/Scooters/scooter5.json +++ b/website/Scooters/scooter5.json @@ -1 +1 @@ -{"data":{"type":"vehicle","id":"4763ce60-5b2e-44cf-919e-fffbff26a15e","attributes":{"state":"ACTIVE","lastLocationUpdate":"2020-10-07T17:43:42Z","lastStateChange":"2020-10-06T19:18:09Z","batteryLevel":94,"lat":52.54126,"lng":13.368985,"maxSpeed":20,"zoneId":"BERLIN","code":284002,"iotVendor":"okai","licencePlate":"078MZT","isRentable":true,"vehicleType":"escooter","hasHelmetBox":true,"hasHelmet":false}}} \ No newline at end of file +{"data":{"type":"vehicle","id":"4763ce60-5b2e-44cf-919e-fffbff26a15e","attributes":{"state":"ACTIVE","lastLocationUpdate":"2020-10-08T16:46:36Z","lastStateChange":"2020-10-06T19:18:09Z","batteryLevel":87,"lat":52.54126,"lng":13.368985,"maxSpeed":20,"zoneId":"BERLIN","code":284002,"iotVendor":"okai","licencePlate":"078MZT","isRentable":true,"vehicleType":"escooter","hasHelmetBox":true,"hasHelmet":false}}} \ No newline at end of file diff --git a/website/Scooters/scooter6.json b/website/Scooters/scooter6.json index 47c904a..0acb262 100644 --- a/website/Scooters/scooter6.json +++ b/website/Scooters/scooter6.json @@ -1 +1 @@ -{"data":{"type":"vehicle","id":"ca884ba2-b0a6-4f3f-b727-fcc33d10182c","attributes":{"state":"ACTIVE","lastLocationUpdate":"2020-10-07T17:37:07Z","lastStateChange":"2020-10-06T20:38:14Z","batteryLevel":95,"lat":52.525817,"lng":13.404346,"maxSpeed":20,"zoneId":"BERLIN","code":279601,"iotVendor":"okai","licencePlate":"359MZW","isRentable":true,"vehicleType":"escooter","hasHelmetBox":true,"hasHelmet":false}}} \ No newline at end of file +{"data":{"type":"vehicle","id":"ca884ba2-b0a6-4f3f-b727-fcc33d10182c","attributes":{"state":"ACTIVE","lastLocationUpdate":"2020-10-08T16:50:20Z","lastStateChange":"2020-10-08T07:16:24Z","batteryLevel":89,"lat":52.525817,"lng":13.404346,"maxSpeed":20,"zoneId":"BERLIN","code":279601,"iotVendor":"okai","licencePlate":"359MZW","isRentable":true,"vehicleType":"escooter","hasHelmetBox":true,"hasHelmet":false}}} \ No newline at end of file diff --git a/website/Scooters/scooter7.json b/website/Scooters/scooter7.json index 610e292..15bc595 100644 --- a/website/Scooters/scooter7.json +++ b/website/Scooters/scooter7.json @@ -1 +1 @@ -{"data":{"type":"vehicle","id":"78e9b9f1-0cf1-4415-9301-e2fe01d39bce","attributes":{"state":"INACTIVE","lastLocationUpdate":"2020-10-07T17:38:41Z","lastStateChange":"2020-10-07T17:21:56Z","batteryLevel":9,"lat":52.512429,"lng":13.316471,"maxSpeed":20,"zoneId":"BERLIN","code":283303,"iotVendor":"okai","licencePlate":"147MZT","isRentable":false,"vehicleType":"escooter","hasHelmetBox":true,"hasHelmet":false}}} \ No newline at end of file +{"data":{"type":"vehicle","id":"78e9b9f1-0cf1-4415-9301-e2fe01d39bce","attributes":{"state":"ACTIVE","lastLocationUpdate":"2020-10-08T16:49:21Z","lastStateChange":"2020-10-08T00:13:27Z","batteryLevel":97,"lat":52.512428,"lng":13.316365,"maxSpeed":20,"zoneId":"BERLIN","code":283303,"iotVendor":"okai","licencePlate":"147MZT","isRentable":true,"vehicleType":"escooter","hasHelmetBox":true,"hasHelmet":false}}} \ No newline at end of file diff --git a/website/Scooters/scooter8.json b/website/Scooters/scooter8.json index 9efe34d..e11d58a 100644 --- a/website/Scooters/scooter8.json +++ b/website/Scooters/scooter8.json @@ -1 +1 @@ -{"data":{"type":"vehicle","id":"0b939caf-80e9-4d6b-8454-4a7f8eaf088c","attributes":{"state":"ACTIVE","lastLocationUpdate":"2020-10-07T17:41:06Z","lastStateChange":"2020-10-05T19:25:58Z","batteryLevel":83,"lat":52.502256,"lng":13.346028,"maxSpeed":20,"zoneId":"BERLIN","code":284530,"iotVendor":"okai","licencePlate":"963MZT","isRentable":true,"vehicleType":"escooter","hasHelmetBox":true,"hasHelmet":false}}} \ No newline at end of file +{"data":{"type":"vehicle","id":"0b939caf-80e9-4d6b-8454-4a7f8eaf088c","attributes":{"state":"ACTIVE","lastLocationUpdate":"2020-10-08T16:48:57Z","lastStateChange":"2020-10-08T10:00:12Z","batteryLevel":75,"lat":52.501228,"lng":13.346171,"maxSpeed":20,"zoneId":"BERLIN","code":284530,"iotVendor":"okai","licencePlate":"963MZT","isRentable":true,"vehicleType":"escooter","hasHelmetBox":true,"hasHelmet":false}}} \ No newline at end of file diff --git a/website/Scooters/scooter9.json b/website/Scooters/scooter9.json index 97779dc..1d2e3fc 100644 --- a/website/Scooters/scooter9.json +++ b/website/Scooters/scooter9.json @@ -1 +1 @@ -{"data":{"type":"vehicle","id":"0f7fa267-4bc1-439a-8fd0-43b98b9ffba7","attributes":{"state":"ACTIVE","lastLocationUpdate":"2020-10-07T17:40:51Z","lastStateChange":"2020-10-05T10:49:36Z","batteryLevel":87,"lat":52.516038,"lng":13.294029,"maxSpeed":20,"zoneId":"BERLIN","code":275306,"iotVendor":"okai","licencePlate":"799MZJ","isRentable":true,"vehicleType":"escooter","hasHelmetBox":true,"hasHelmet":false}}} \ No newline at end of file +{"data":{"type":"vehicle","id":"0f7fa267-4bc1-439a-8fd0-43b98b9ffba7","attributes":{"state":"ACTIVE","lastLocationUpdate":"2020-10-08T16:43:45Z","lastStateChange":"2020-10-05T10:49:36Z","batteryLevel":78,"lat":52.516198,"lng":13.294055,"maxSpeed":20,"zoneId":"BERLIN","code":275306,"iotVendor":"okai","licencePlate":"799MZJ","isRentable":true,"vehicleType":"escooter","hasHelmetBox":true,"hasHelmet":false}}} \ No newline at end of file diff --git a/website/Speedshow_Map.py b/website/Speedshow_Map.py index 506db5c..13cadb5 100644 --- a/website/Speedshow_Map.py +++ b/website/Speedshow_Map.py @@ -5,48 +5,52 @@ import subprocess from datetime import datetime from glob import glob -#create map object -m = folium.Map(location=[52.516190, 13.377693], tiles='Stamen Toner',zoom_start=13, zoom_control=False) - -#make api request (writes api responses to json) - -subprocess.call(['sh','./scooter_locations.sh']) - -#import scooter data - -scooter_counter = 1 - -for file in glob('Scooters/*.json'): - print ('importing data of scooter nr.' + str(scooter_counter) + '/10') - with open(file, '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) - print('imported. moving on...') - - #create markers for scooter - print('creating marker for scooter nr.' + str(scooter_counter) + '/10') - folium.Marker([lat,lng], - popup='ARTIST_NAME + ARTWORK_TITLE', - tooltip='ARTIST_NAME_HERE', - icon=folium.Icon(icon='cloud')).add_to(m) - print('created. moving on...') - scooter_counter = scooter_counter+1 - -#generate map.html -m.save('map.html') -#adding mobile support -m.get_root().header.add_child(folium.Element( - '' -)) -#saving timestamp -print('generating timestamp') -with open('datetime.txt', 'w') as timestamp: - timestamp.write(str(datetime.now())) -print('finished!') \ No newline at end of file +def application(): + #create map object + m = folium.Map(location=[52.516190, 13.377693], tiles='Stamen Toner',zoom_start=13, zoom_control=False, max_zoom=25) + + #make api request (writes api responses to json) + + subprocess.call(['sh','./scooter_locations.sh']) + + #import scooter data + + scooter_counter = 1 + + for file in glob('Scooters/*.json'): + print ('importing data of scooter nr.' + str(scooter_counter) + '/10') + with open(file, '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) + print('imported. moving on...') + + #create markers for scooter + print('creating marker for scooter nr.' + str(scooter_counter) + '/10') + folium.Marker([lat,lng], + popup='ARTIST_NAME + ARTWORK_TITLE', + tooltip='ARTIST_NAME_HERE', + icon=folium.Icon(icon='cloud')).add_to(m) + print('created. moving on...') + scooter_counter = scooter_counter+1 + + #generate map.html + m.save('map.html') + #adding mobile support + m.get_root().header.add_child(folium.Element( + '' + )) + + #saving timestamp + print('generating timestamp') + with open('datetime.txt', 'w') as timestamp: + timestamp.write(str(datetime.now())) + print('finished!') + +application() \ No newline at end of file diff --git a/website/datetime.txt b/website/datetime.txt index a612f67..05a3418 100644 --- a/website/datetime.txt +++ b/website/datetime.txt @@ -1 +1 @@ -2020-10-07 19:44:16.700230 \ No newline at end of file +2020-10-08 18:52:12.650105 \ No newline at end of file diff --git a/website/index.php b/website/index.php index 7c0a565..d955684 100644 --- a/website/index.php +++ b/website/index.php @@ -4,6 +4,7 @@ Opencoil Speedshow + diff --git a/website/map.html b/website/map.html index 2738704..c1214e7 100644 --- a/website/map.html +++ b/website/map.html @@ -23,7 +23,7 @@