gps data from api

This commit is contained in:
Anton Linus 2020-09-02 22:54:09 +02:00
parent cba2877173
commit 7a2257b7f5
2 changed files with 26 additions and 22 deletions

View File

@ -1,16 +1,20 @@
import folium import folium
import requests import requests
import pprint import json
#make api requests #import scooter data
r = requests.get('https://platform.tier-services.io') with open('1scooter.json') as file:
data = json.load(file)
lat = data['data']['attributes']['lat']
lng = data['data']['attributes']['lng']
#create map object #create map object
m = folium.Map(location=[52.521302, 13.410377], zoom_start=15) m = folium.Map(location=[lat, lng], zoom_start=15)
#create markers #create markers
folium.Marker([52.511154,13.442811], folium.Marker([lat,lng],
popup='<strong>Berghain<strong/>', popup='<strong>Berghain<strong/>',
tooltip='ja was isch jetzt aus des?', tooltip='ja was isch jetzt aus des?',
icon=folium.Icon(icon='cloud')).add_to(m) icon=folium.Icon(icon='cloud')).add_to(m)

View File

@ -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_dfca3c23076d41188a1381319527bb63 { #map_cb793048355a4c4b8a0ff7cbba37c3a4 {
position: relative; position: relative;
width: 100.0%; width: 100.0%;
height: 100.0%; height: 100.0%;
@ -35,15 +35,15 @@
</head> </head>
<body> <body>
<div class="folium-map" id="map_dfca3c23076d41188a1381319527bb63" ></div> <div class="folium-map" id="map_cb793048355a4c4b8a0ff7cbba37c3a4" ></div>
</body> </body>
<script> <script>
var map_dfca3c23076d41188a1381319527bb63 = L.map( var map_cb793048355a4c4b8a0ff7cbba37c3a4 = L.map(
"map_dfca3c23076d41188a1381319527bb63", "map_cb793048355a4c4b8a0ff7cbba37c3a4",
{ {
center: [52.521302, 13.410377], center: [52.487175, 13.364731],
crs: L.CRS.EPSG3857, crs: L.CRS.EPSG3857,
zoom: 15, zoom: 15,
zoomControl: true, zoomControl: true,
@ -55,38 +55,38 @@
var tile_layer_761748f29b8f45c09f4f45c3838e7c5e = L.tileLayer( var tile_layer_461179e7827a4cdd866fb89391f23aae = 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_dfca3c23076d41188a1381319527bb63); ).addTo(map_cb793048355a4c4b8a0ff7cbba37c3a4);
var marker_f17f71a63d4d46c2ad33c54652de4020 = L.marker( var marker_725f832c88be4e7ba9adf6b631864300 = L.marker(
[52.511154, 13.442811], [52.487175, 13.364731],
{} {}
).addTo(map_dfca3c23076d41188a1381319527bb63); ).addTo(map_cb793048355a4c4b8a0ff7cbba37c3a4);
var icon_9cdb3862dc464d67b95cf3ed9238384c = L.AwesomeMarkers.icon( var icon_b90652a1cbcf4c01b0ac2f7622ce47a7 = 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_f17f71a63d4d46c2ad33c54652de4020.setIcon(icon_9cdb3862dc464d67b95cf3ed9238384c); marker_725f832c88be4e7ba9adf6b631864300.setIcon(icon_b90652a1cbcf4c01b0ac2f7622ce47a7);
var popup_9f4f5b76a40b46f8a3d3fdd86d795f85 = L.popup({"maxWidth": "100%"}); var popup_a5bf051e2cf84f81963121ee6d794ec4 = L.popup({"maxWidth": "100%"});
var html_aa75478c94fe42b4951dfa1f50a7c344 = $(`<div id="html_aa75478c94fe42b4951dfa1f50a7c344" style="width: 100.0%; height: 100.0%;"><strong>Berghain<strong/></div>`)[0]; var html_4524f3e131a84784ade2d8469abf57bc = $(`<div id="html_4524f3e131a84784ade2d8469abf57bc" style="width: 100.0%; height: 100.0%;"><strong>Berghain<strong/></div>`)[0];
popup_9f4f5b76a40b46f8a3d3fdd86d795f85.setContent(html_aa75478c94fe42b4951dfa1f50a7c344); popup_a5bf051e2cf84f81963121ee6d794ec4.setContent(html_4524f3e131a84784ade2d8469abf57bc);
marker_f17f71a63d4d46c2ad33c54652de4020.bindPopup(popup_9f4f5b76a40b46f8a3d3fdd86d795f85) marker_725f832c88be4e7ba9adf6b631864300.bindPopup(popup_a5bf051e2cf84f81963121ee6d794ec4)
; ;
marker_f17f71a63d4d46c2ad33c54652de4020.bindTooltip( marker_725f832c88be4e7ba9adf6b631864300.bindTooltip(
`<div> `<div>
ja was isch jetzt aus des? ja was isch jetzt aus des?
</div>`, </div>`,