mirror of
https://gitlab.com/little-lines/frontend.git
synced 2024-11-22 01:36:53 +00:00
send info wheelchair to destinationinfocard
This commit is contained in:
parent
3869ea5e19
commit
d19acda808
2 changed files with 32 additions and 19 deletions
|
@ -255,8 +255,8 @@ export default {
|
|||
this.onClose();
|
||||
},
|
||||
viewRoute() {
|
||||
this.getUserLocation();
|
||||
this.showRoute = true;
|
||||
this.getUserLocation();
|
||||
this.showRoute = true;
|
||||
},
|
||||
enterRoute() {
|
||||
console.log('Entering Route!');
|
||||
|
|
|
@ -130,6 +130,7 @@ const popupData = ref(null);
|
|||
|
||||
const isRouting = ref(false);
|
||||
const route = ref(null);
|
||||
const infoWheelchair = ref(null)
|
||||
const strokeWidth = ref(5);
|
||||
const strokeColor = ref("red");
|
||||
|
||||
|
@ -165,24 +166,11 @@ const performSearch = async () => {
|
|||
//Show API
|
||||
const handleMapClick = async event => {
|
||||
const clickedCoordinate = event.coordinate;
|
||||
|
||||
try {
|
||||
const response = await axios.get(
|
||||
`https://nominatim.openstreetmap.org/reverse?format=json&lat=${clickedCoordinate[1]}&lon=${clickedCoordinate[0]}`
|
||||
);
|
||||
|
||||
const nearestStructureData = response.data;
|
||||
popupData.value = nearestStructureData; // Show popup
|
||||
|
||||
} 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"];
|
||||
node(around:10,${clickedCoordinate[1]},${clickedCoordinate[0]})["wheelchair"];
|
||||
way(around:10,${clickedCoordinate[1]},${clickedCoordinate[0]})["wheelchair"];
|
||||
relation(around:10,${clickedCoordinate[1]},${clickedCoordinate[0]})["wheelchair"];
|
||||
);
|
||||
out;`;
|
||||
const overpassUrl = 'https://overpass-api.de/api/interpreter';
|
||||
|
@ -193,10 +181,35 @@ out;`;
|
|||
},
|
||||
}).then(response => {
|
||||
// Process the data returned by the Overpass API
|
||||
console.log(response.data);
|
||||
response.data.elements.forEach(element => {
|
||||
if (element.tags && element.tags.wheelchair) {
|
||||
console.log(`wheelchair: ${element.tags.wheelchair}`);
|
||||
const wheelchairValues = element.tags.wheelchair;
|
||||
infoWheelchair.value = wheelchairValues;
|
||||
}
|
||||
})
|
||||
}).catch(error => {
|
||||
console.error('Error fetching data from Overpass API:', error);
|
||||
});
|
||||
|
||||
try {
|
||||
const response = await axios.get(
|
||||
`https://nominatim.openstreetmap.org/reverse?format=json&lat=${clickedCoordinate[1]}&lon=${clickedCoordinate[0]}`
|
||||
);
|
||||
|
||||
let nearestStructureData = response.data;
|
||||
|
||||
nearestStructureData = {
|
||||
...nearestStructureData,
|
||||
infoWheelchair: infoWheelchair.value
|
||||
}
|
||||
//infoWheelchair can null,yes,no
|
||||
popupData.value = nearestStructureData; // Show popup
|
||||
|
||||
// console.log(nearestStructureData)
|
||||
} catch (error) {
|
||||
console.error("Error fetching reverse geocoding data:", error);
|
||||
}
|
||||
};
|
||||
|
||||
const closePopup = () => {
|
||||
|
|
Loading…
Reference in a new issue