From 6317422824db9280be92aa7c2fb54aa4f6e58d06 Mon Sep 17 00:00:00 2001 From: Late Night Defender Date: Wed, 6 Dec 2023 22:13:26 +0700 Subject: [PATCH 1/3] Use .env on server side --- little-lines-frontend.container | 1 + 1 file changed, 1 insertion(+) diff --git a/little-lines-frontend.container b/little-lines-frontend.container index 3e62b8e..6d515f9 100644 --- a/little-lines-frontend.container +++ b/little-lines-frontend.container @@ -5,6 +5,7 @@ Description=Little Lines frontend container ContainerName=little-lines-frontend Image=localhost/little-lines-frontend PublishPort=8081:5173 +Volume=/media/sasha/Data1/Apps/ll-frontend/.env:/opt/little-lines-frontend/.env [Service] Restart=always From 760d868dc201703ab68388982b236e331356f34a Mon Sep 17 00:00:00 2001 From: NekoVari Date: Thu, 7 Dec 2023 21:24:23 +0700 Subject: [PATCH 2/3] implement stop routing --- src/components/DestinationInfoCard.vue | 49 +++++++++++++++----------- src/views/Home.vue | 2 +- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/src/components/DestinationInfoCard.vue b/src/components/DestinationInfoCard.vue index 5bf3c95..a3e846f 100644 --- a/src/components/DestinationInfoCard.vue +++ b/src/components/DestinationInfoCard.vue @@ -243,7 +243,7 @@ export default { showRoute: false, userLocation: null, isLocationRequested: false, - + isRouting: false, }; }, computed: { @@ -262,6 +262,10 @@ export default { methods: { closePopup() { this.showPopup = false; + + this.$emit('updateRouting', {route:null,isRouting:false}); + this.isRouting = false; + this.onClose(); }, viewRoute() { @@ -291,8 +295,11 @@ export default { console.error('Error getting location:', error); }, viewPopup(){ - this.showPopup = true; - this.showRoute = false; + this.showPopup = true; + this.showRoute = false; + + this.$emit('updateRouting', {route:null,isRouting:false}); + this.isRouting = false; }, addToFavorites() { const currentUser = JSON.parse(sessionStorage.getItem('current_user')); @@ -333,24 +340,26 @@ export default { } }, Routing(){ - console.log('Start routing!!'); - console.log(`nearestStructureData : ${this.nearestStructureData.lon},${this.nearestStructureData.lat}`); - console.log(`userLocation : ${this.userLocation.lon},${this.userLocation.lat}`); - // Make a request to OpenRouteService API for a sample route - const apiKey = import.meta.env.VITE_OPENROUTESERVICE_API_KEY; - const startCoord = `${this.userLocation.lon},${this.userLocation.lat}`;//'100.53860,13.76410'; - const endCoord = `${this.nearestStructureData.lon},${this.nearestStructureData.lat}`;//'100.53928,13.76526'; + if(!this.isRouting){ + console.log('Start routing!!'); + console.log(`nearestStructureData : ${this.nearestStructureData.lon},${this.nearestStructureData.lat}`); + console.log(`userLocation : ${this.userLocation.lon},${this.userLocation.lat}`); + // Make a request to OpenRouteService API for a sample route + const apiKey = import.meta.env.VITE_OPENROUTESERVICE_API_KEY; + const startCoord = `${this.userLocation.lon},${this.userLocation.lat}`;//'100.53860,13.76410'; + const endCoord = `${this.nearestStructureData.lon},${this.nearestStructureData.lat}`;//'100.53928,13.76526'; - axios.get(`https://api.openrouteservice.org/v2/directions/wheelchair?api_key=${apiKey}&start=${startCoord}&end=${endCoord}`) - .then(response => { - const route = response.data.features[0].geometry.coordinates; - console.log('This is route :',{route:route}) - this.$emit('updateRouting', {route:route}); - // this.plotRoute(route); - }) - .catch(error => { - console.error('Error fetching route:', error); - }); + axios.get(`https://api.openrouteservice.org/v2/directions/wheelchair?api_key=${apiKey}&start=${startCoord}&end=${endCoord}`) + .then(response => { + const route = response.data.features[0].geometry.coordinates; + console.log('This is route :',{route:route}) + this.$emit('updateRouting', {route:route,isRouting:true}); + this.isRouting = true; + }) + .catch(error => { + console.error('Error fetching route:', error); + }); + } }, }, diff --git a/src/views/Home.vue b/src/views/Home.vue index 9b2255e..fcf55c3 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -189,7 +189,7 @@ const closePopup = () => { const handleRouting = (res) => { console.log("Received Route:", res); route.value = res.route; - isRouting.value = true; + isRouting.value = res.isRouting; }; From 3c4499cb6698c8ae228dd53660cdd7c033a396d5 Mon Sep 17 00:00:00 2001 From: NekoVari Date: Fri, 8 Dec 2023 13:43:50 +0700 Subject: [PATCH 3/3] access to wheelchar data --- src/views/Home.vue | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/views/Home.vue b/src/views/Home.vue index fcf55c3..1a13db0 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -180,6 +180,26 @@ const handleMapClick = async event => { } catch (error) { console.error("Error fetching reverse geocoding data:", error); } + + const overpassQuery = `[out:json]; +( + node(around:1000,${clickedCoordinate[1]},${clickedCoordinate[0]})["wheelchair"="yes"]; + way(around:1000,${clickedCoordinate[1]},${clickedCoordinate[0]})["wheelchair"="yes"]; + relation(around:1000,${clickedCoordinate[1]},${clickedCoordinate[0]})["wheelchair"="yes"]; +); +out;`; + const overpassUrl = 'https://overpass-api.de/api/interpreter'; + + axios.post(overpassUrl, `data=${encodeURIComponent(overpassQuery)}`, { + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + }).then(response => { + // Process the data returned by the Overpass API + console.log(response.data); + }).catch(error => { + console.error('Error fetching data from Overpass API:', error); + }); }; const closePopup = () => {