Skip to content

Commit

Permalink
Fix a dependency issue
Browse files Browse the repository at this point in the history
  • Loading branch information
flosoft committed Dec 26, 2022
1 parent b8e57a7 commit cc6b57c
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ services:
ports:
- "5051:5051"
```
You will be able to access the Admin Interface on /admin in your serving directory to create your links to share.

A more in depth guide on how to run it behind Traefik alongside TeslaLogger, can be found [here](https://florianjensen.com/2022/08/20/sharing-your-eta-with-teslaeta/).

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
certifi==2022.12.7
charset-normalizer==3.0.1
charset-normalizer==2.1.1
click==8.1.3
colorama==0.4.6
Flask==2.2.2
Expand Down
88 changes: 88 additions & 0 deletions templates/map_admin_create.html.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<title>Set a point after Geocoder result</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<link href="https://api.mapbox.com/mapbox-gl-js/v2.11.0/mapbox-gl.css" rel="stylesheet">
<script src="https://api.mapbox.com/mapbox-gl-js/v2.11.0/mapbox-gl.js"></script>
<style>
body {
margin: 0;
padding: 0;
}
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
</style>
</head>

<body>
<script
src="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v5.0.0/mapbox-gl-geocoder.min.js"></script>
<link rel="stylesheet"
href="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v5.0.0/mapbox-gl-geocoder.css"
type="text/css">

<style>
#geocoder-container>div {
min-width: 50%;
margin-left: 25%;
}
</style>
<div id="map"></div>

<script>
var marker_lat = 0
var marker_lng = 0
mapboxgl.accessToken = '{{ mbtoken }}';
const map = new mapboxgl.Map({
container: 'map',
// Choose from Mapbox's core styles, or make your own style with Mapbox Studio
style: 'mapbox://styles/mapbox/navigation-guidance-day-v4',
center: [{{ car_location[0] }}, {{ car_location[1] }}],
zoom: 13
});
const geocoder = new MapboxGeocoder({
accessToken: mapboxgl.accessToken,
marker: {
color: 'orange',
draggable: true
},
mapboxgl: mapboxgl,
proximity: {
longitude: {{ car_location[0] }},
latitude: {{ car_location[1] }}
}
});
map.addControl(geocoder);
function updateVars() {
marker_lat = geocoder.mapMarker.getLngLat().lat
marker_lng = geocoder.mapMarker.getLngLat().lng
console.log("UPDATED VARS", marker_lat, marker_lng)
};
function dragUpdater() {
geocoder.mapMarker.on('dragend', updateVars)
};
geocoder.addControl
geocoder.on('result', updateVars);
geocoder.on('result', dragUpdater);
</script>

</body>

</html>

0 comments on commit cc6b57c

Please sign in to comment.