Browse Source

website

master
Anton Linus 4 years ago
parent
commit
6e455e93f6
  1. BIN
      .DS_Store
  2. BIN
      website/.DS_Store
  3. 1
      website/1scooter.json
  4. 5
      website/Speedshow_Map
  5. 19
      website/Speedshow_Map.py
  6. 7
      website/apirequests.py
  7. 8
      website/jsonreader.py
  8. 96
      website/map.html
  9. 1
      website/scooters.json

BIN
.DS_Store

Binary file not shown.

BIN
website/.DS_Store

Binary file not shown.

1
website/1scooter.json

@ -0,0 +1 @@
{"data":{"type":"vehicle","id":"f6f55778-9339-4f81-8584-7645f3a6c4be","attributes":{"state":"ACTIVE","lastLocationUpdate":"2020-09-02T20:22:04Z","lastStateChange":"2020-09-01T12:50:06Z","batteryLevel":98,"lat":52.487175,"lng":13.364731,"maxSpeed":20,"zoneId":"BERLIN","code":239365,"iotVendor":"okai","licencePlate":"580WUL","isRentable":true,"vehicleType":"escooter","hasHelmetBox":false,"hasHelmet":false}}}

5
website/Speedshow_Map

@ -0,0 +1,5 @@
import folium
m = folium.Map(location=[], zoom_start=12)
m.save('/map')

19
website/Speedshow_Map.py

@ -0,0 +1,19 @@
import folium
import requests
import pprint
#make api requests
r = requests.get('https://platform.tier-services.io')
#create map object
m = folium.Map(location=[52.521302, 13.410377], zoom_start=15)
#create markers
folium.Marker([52.511154,13.442811],
popup='<strong>Berghain<strong/>',
tooltip='ja was isch jetzt aus des?',
icon=folium.Icon(icon='cloud')).add_to(m)
#generate map.html
m.save('map.html')

7
website/apirequests.py

@ -0,0 +1,7 @@
import requests
r = requests.get('https://platform.tier-services.io')
f6f55778-9339-4f81-8584-7645f3a6c4be
curl "https://platform.tier-services.io/v2/vehicle/f6f55778-9339-4f81-8584-7645f3a6c4be" -H "x-api-key: bpEUTJEBTf74oGRWxaIcW7aeZMzDDODe1yBoSxi2"

8
website/jsonreader.py

@ -0,0 +1,8 @@
import json
import pprint
with open('1scooter.json') as file:
data = json.load(file)
print(json.dumps(data, indent=4, sort_keys=True))

96
website/map.html

@ -0,0 +1,96 @@
<!DOCTYPE html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script>
L_NO_TOUCH = false;
L_DISABLE_3D = false;
</script>
<script src="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.js"></script>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.css"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css"/>
<link rel="stylesheet" href="https://rawcdn.githack.com/python-visualization/folium/master/folium/templates/leaflet.awesome.rotate.css"/>
<style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>
<style>#map {position:absolute;top:0;bottom:0;right:0;left:0;}</style>
<meta name="viewport" content="width=device-width,
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
#map_dfca3c23076d41188a1381319527bb63 {
position: relative;
width: 100.0%;
height: 100.0%;
left: 0.0%;
top: 0.0%;
}
</style>
</head>
<body>
<div class="folium-map" id="map_dfca3c23076d41188a1381319527bb63" ></div>
</body>
<script>
var map_dfca3c23076d41188a1381319527bb63 = L.map(
"map_dfca3c23076d41188a1381319527bb63",
{
center: [52.521302, 13.410377],
crs: L.CRS.EPSG3857,
zoom: 15,
zoomControl: true,
preferCanvas: false,
}
);
var tile_layer_761748f29b8f45c09f4f45c3838e7c5e = L.tileLayer(
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
{"attribution": "Data by \u0026copy; \u003ca href=\"http://openstreetmap.org\"\u003eOpenStreetMap\u003c/a\u003e, under \u003ca href=\"http://www.openstreetmap.org/copyright\"\u003eODbL\u003c/a\u003e.", "detectRetina": false, "maxNativeZoom": 18, "maxZoom": 18, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}
).addTo(map_dfca3c23076d41188a1381319527bb63);
var marker_f17f71a63d4d46c2ad33c54652de4020 = L.marker(
[52.511154, 13.442811],
{}
).addTo(map_dfca3c23076d41188a1381319527bb63);
var icon_9cdb3862dc464d67b95cf3ed9238384c = L.AwesomeMarkers.icon(
{"extraClasses": "fa-rotate-0", "icon": "cloud", "iconColor": "white", "markerColor": "blue", "prefix": "glyphicon"}
);
marker_f17f71a63d4d46c2ad33c54652de4020.setIcon(icon_9cdb3862dc464d67b95cf3ed9238384c);
var popup_9f4f5b76a40b46f8a3d3fdd86d795f85 = L.popup({"maxWidth": "100%"});
var html_aa75478c94fe42b4951dfa1f50a7c344 = $(`<div id="html_aa75478c94fe42b4951dfa1f50a7c344" style="width: 100.0%; height: 100.0%;"><strong>Berghain<strong/></div>`)[0];
popup_9f4f5b76a40b46f8a3d3fdd86d795f85.setContent(html_aa75478c94fe42b4951dfa1f50a7c344);
marker_f17f71a63d4d46c2ad33c54652de4020.bindPopup(popup_9f4f5b76a40b46f8a3d3fdd86d795f85)
;
marker_f17f71a63d4d46c2ad33c54652de4020.bindTooltip(
`<div>
ja was isch jetzt aus des?
</div>`,
{"sticky": true}
);
</script>

1
website/scooters.json

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save