mirror of
https://gitlab.com/little-lines/frontend.git
synced 2024-11-25 08:46:51 +00:00
real data routing
This commit is contained in:
parent
b43eacd22f
commit
2c7bfa7ab1
1 changed files with 6 additions and 3 deletions
|
@ -254,7 +254,6 @@ export default {
|
||||||
if (this.isLocationRequested && !this.userLocation) {
|
if (this.isLocationRequested && !this.userLocation) {
|
||||||
return 'Requesting location...';
|
return 'Requesting location...';
|
||||||
} else if (this.userLocation) {
|
} else if (this.userLocation) {
|
||||||
this.Routing();
|
|
||||||
return `${this.userLocation.lon.toFixed(6)}, ${this.userLocation.lat.toFixed(6)}`;
|
return `${this.userLocation.lon.toFixed(6)}, ${this.userLocation.lat.toFixed(6)}`;
|
||||||
}
|
}
|
||||||
return 'Location not available';
|
return 'Location not available';
|
||||||
|
@ -271,6 +270,7 @@ export default {
|
||||||
},
|
},
|
||||||
enterRoute() {
|
enterRoute() {
|
||||||
console.log('Entering Route!');
|
console.log('Entering Route!');
|
||||||
|
this.Routing();
|
||||||
},
|
},
|
||||||
getUserLocation() {
|
getUserLocation() {
|
||||||
this.isLocationRequested = true;
|
this.isLocationRequested = true;
|
||||||
|
@ -333,10 +333,13 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Routing(){
|
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
|
// Make a request to OpenRouteService API for a sample route
|
||||||
const apiKey = import.meta.env.VITE_OPENROUTESERVICE_API_KEY;
|
const apiKey = import.meta.env.VITE_OPENROUTESERVICE_API_KEY;
|
||||||
const startCoord = '100.53860,13.76410'; //(lon,lat) test data
|
const startCoord = `${this.userLocation.lon},${this.userLocation.lat}`;//'100.53860,13.76410';
|
||||||
const endCoord = '100.53928,13.76526';//(lon,lat) test data
|
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}`)
|
axios.get(`https://api.openrouteservice.org/v2/directions/wheelchair?api_key=${apiKey}&start=${startCoord}&end=${endCoord}`)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
|
Loading…
Reference in a new issue