real data routing

This commit is contained in:
NekoVari 2023-12-06 18:22:16 +07:00
parent b43eacd22f
commit 2c7bfa7ab1

View file

@ -254,7 +254,6 @@ export default {
if (this.isLocationRequested && !this.userLocation) {
return 'Requesting location...';
} else if (this.userLocation) {
this.Routing();
return `${this.userLocation.lon.toFixed(6)}, ${this.userLocation.lat.toFixed(6)}`;
}
return 'Location not available';
@ -271,6 +270,7 @@ export default {
},
enterRoute() {
console.log('Entering Route!');
this.Routing();
},
getUserLocation() {
this.isLocationRequested = true;
@ -333,10 +333,13 @@ 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 = '100.53860,13.76410'; //(lon,lat) test data
const endCoord = '100.53928,13.76526';//(lon,lat) test data
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 => {