diff --git a/src/components/DestinationInfoCard.vue b/src/components/DestinationInfoCard.vue index 7474dff..362e591 100644 --- a/src/components/DestinationInfoCard.vue +++ b/src/components/DestinationInfoCard.vue @@ -255,8 +255,8 @@ export default { this.onClose(); }, viewRoute() { - this.getUserLocation(); - this.showRoute = true; + this.getUserLocation(); + this.showRoute = true; }, enterRoute() { console.log('Entering Route!'); diff --git a/src/views/Home.vue b/src/views/Home.vue index def552d..1511d82 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -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 = () => {