mirror of
https://gitlab.com/little-lines/frontend.git
synced 2024-11-25 10:06:51 +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
|
@ -130,6 +130,7 @@ const popupData = ref(null);
|
||||||
|
|
||||||
const isRouting = ref(false);
|
const isRouting = ref(false);
|
||||||
const route = ref(null);
|
const route = ref(null);
|
||||||
|
const infoWheelchair = ref(null)
|
||||||
const strokeWidth = ref(5);
|
const strokeWidth = ref(5);
|
||||||
const strokeColor = ref("red");
|
const strokeColor = ref("red");
|
||||||
|
|
||||||
|
@ -165,24 +166,11 @@ const performSearch = async () => {
|
||||||
//Show API
|
//Show API
|
||||||
const handleMapClick = async event => {
|
const handleMapClick = async event => {
|
||||||
const clickedCoordinate = event.coordinate;
|
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];
|
const overpassQuery = `[out:json];
|
||||||
(
|
(
|
||||||
node(around:1000,${clickedCoordinate[1]},${clickedCoordinate[0]})["wheelchair"="yes"];
|
node(around:10,${clickedCoordinate[1]},${clickedCoordinate[0]})["wheelchair"];
|
||||||
way(around:1000,${clickedCoordinate[1]},${clickedCoordinate[0]})["wheelchair"="yes"];
|
way(around:10,${clickedCoordinate[1]},${clickedCoordinate[0]})["wheelchair"];
|
||||||
relation(around:1000,${clickedCoordinate[1]},${clickedCoordinate[0]})["wheelchair"="yes"];
|
relation(around:10,${clickedCoordinate[1]},${clickedCoordinate[0]})["wheelchair"];
|
||||||
);
|
);
|
||||||
out;`;
|
out;`;
|
||||||
const overpassUrl = 'https://overpass-api.de/api/interpreter';
|
const overpassUrl = 'https://overpass-api.de/api/interpreter';
|
||||||
|
@ -193,10 +181,35 @@ out;`;
|
||||||
},
|
},
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
// Process the data returned by the Overpass API
|
// 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 => {
|
}).catch(error => {
|
||||||
console.error('Error fetching data from Overpass API:', 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 = () => {
|
const closePopup = () => {
|
||||||
|
|
Loading…
Reference in a new issue