access to wheelchar data

This commit is contained in:
NekoVari 2023-12-08 13:43:50 +07:00
parent 760d868dc2
commit 3c4499cb66

View file

@ -180,6 +180,26 @@ const handleMapClick = async event => {
} catch (error) { } catch (error) {
console.error("Error fetching reverse geocoding data:", 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"];
);
out;`;
const overpassUrl = 'https://overpass-api.de/api/interpreter';
axios.post(overpassUrl, `data=${encodeURIComponent(overpassQuery)}`, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
}).then(response => {
// Process the data returned by the Overpass API
console.log(response.data);
}).catch(error => {
console.error('Error fetching data from Overpass API:', error);
});
}; };
const closePopup = () => { const closePopup = () => {