Browse Source

updates

master
Anton Linus 4 years ago
parent
commit
ce30809231
  1. 14
      website/Speedshow_Map.py
  2. 9
      website/apirequests.py
  3. 30
      website/map.html

14
website/Speedshow_Map.py

@ -1,14 +1,18 @@
import folium import folium
import requests import requests
import json import json
import subprocess
#import scooter data #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
with open('1scooter.json') as file: #import scooter data
data = json.load(file)
lat = data['data']['attributes']['lat'] lat = request_scooter1['data']['attributes']['lat']
lng = data['data']['attributes']['lng'] lng = request_scooter1['data']['attributes']['lng']
#create map object #create map object
m = folium.Map(location=[52.516190, 13.377693], zoom_start=13) m = folium.Map(location=[52.516190, 13.377693], zoom_start=13)

9
website/apirequests.py

@ -1,7 +1,6 @@
import requests import requests
import subprocess
r = requests.get('https://platform.tier-services.io') 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()
f6f55778-9339-4f81-8584-7645f3a6c4be print(stdout(['43data']))
curl "https://platform.tier-services.io/v2/vehicle/f6f55778-9339-4f81-8584-7645f3a6c4be" -H "x-api-key: bpEUTJEBTf74oGRWxaIcW7aeZMzDDODe1yBoSxi2"

30
website/map.html

@ -23,7 +23,7 @@
<meta name="viewport" content="width=device-width, <meta name="viewport" content="width=device-width,
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style> <style>
#map_800f23ef42b2486c9365a331953c6b9d { #map_3ef0a52969c54ff8ac70f9cc4748c3bf {
position: relative; position: relative;
width: 100.0%; width: 100.0%;
height: 100.0%; height: 100.0%;
@ -35,13 +35,13 @@
</head> </head>
<body> <body>
<div class="folium-map" id="map_800f23ef42b2486c9365a331953c6b9d" ></div> <div class="folium-map" id="map_3ef0a52969c54ff8ac70f9cc4748c3bf" ></div>
</body> </body>
<script> <script>
var map_800f23ef42b2486c9365a331953c6b9d = L.map( var map_3ef0a52969c54ff8ac70f9cc4748c3bf = L.map(
"map_800f23ef42b2486c9365a331953c6b9d", "map_3ef0a52969c54ff8ac70f9cc4748c3bf",
{ {
center: [52.51619, 13.377693], center: [52.51619, 13.377693],
crs: L.CRS.EPSG3857, crs: L.CRS.EPSG3857,
@ -55,38 +55,38 @@
var tile_layer_a2d80cb8330b41349a0223f33625aa01 = L.tileLayer( var tile_layer_3ca208d1acf54213bf1d31ec9500d096 = L.tileLayer(
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", "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} {"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_800f23ef42b2486c9365a331953c6b9d); ).addTo(map_3ef0a52969c54ff8ac70f9cc4748c3bf);
var marker_deefa72b26194f21bcf038a7dcc13975 = L.marker( var marker_e15ded27b9a149059fd2c199ba277590 = L.marker(
[52.487175, 13.364731], [52.487175, 13.364731],
{} {}
).addTo(map_800f23ef42b2486c9365a331953c6b9d); ).addTo(map_3ef0a52969c54ff8ac70f9cc4748c3bf);
var icon_cd8eb8abc975473096904bb63276e054 = L.AwesomeMarkers.icon( var icon_ae7b0f3ca8a24a5aa89c02613a27ee5b = L.AwesomeMarkers.icon(
{"extraClasses": "fa-rotate-0", "icon": "cloud", "iconColor": "white", "markerColor": "blue", "prefix": "glyphicon"} {"extraClasses": "fa-rotate-0", "icon": "cloud", "iconColor": "white", "markerColor": "blue", "prefix": "glyphicon"}
); );
marker_deefa72b26194f21bcf038a7dcc13975.setIcon(icon_cd8eb8abc975473096904bb63276e054); marker_e15ded27b9a149059fd2c199ba277590.setIcon(icon_ae7b0f3ca8a24a5aa89c02613a27ee5b);
var popup_6e040f480948411cb5fec5212343ca9d = L.popup({"maxWidth": "100%"}); var popup_c532ec577baa4a69a2278ac8393307f9 = L.popup({"maxWidth": "100%"});
var html_20674ff629474a07b3cfc372a04667eb = $(`<div id="html_20674ff629474a07b3cfc372a04667eb" style="width: 100.0%; height: 100.0%;"><strong>ARTIST_NAME + ARTWORK_TITLE<strong/></div>`)[0]; var html_162a3259d35d4d3c985710cdc2e7e870 = $(`<div id="html_162a3259d35d4d3c985710cdc2e7e870" style="width: 100.0%; height: 100.0%;"><strong>ARTIST_NAME + ARTWORK_TITLE<strong/></div>`)[0];
popup_6e040f480948411cb5fec5212343ca9d.setContent(html_20674ff629474a07b3cfc372a04667eb); popup_c532ec577baa4a69a2278ac8393307f9.setContent(html_162a3259d35d4d3c985710cdc2e7e870);
marker_deefa72b26194f21bcf038a7dcc13975.bindPopup(popup_6e040f480948411cb5fec5212343ca9d) marker_e15ded27b9a149059fd2c199ba277590.bindPopup(popup_c532ec577baa4a69a2278ac8393307f9)
; ;
marker_deefa72b26194f21bcf038a7dcc13975.bindTooltip( marker_e15ded27b9a149059fd2c199ba277590.bindTooltip(
`<div> `<div>
ARTIST_NAME_HERE ARTIST_NAME_HERE
</div>`, </div>`,

Loading…
Cancel
Save