async function fetchOsmWaysForNode(nodeId) {
const osmApiResult = await fetch(
`https://api.openstreetmap.org/api/0.6/node/${nodeId}/ways`
)
.then((response) => response.text())
.then((str) => new window.DOMParser().parseFromString(str, "text/xml"));
const ways = [];
for (let way of osmApiResult.getElementsByTagName("way")) {
const tags = {};
const tagNodes = way.getElementsByTagName("tag");
for (let tagNode of tagNodes) {
tags[tagNode.getAttribute("k")] = tagNode.getAttribute("v");
}
ways.push({
id: way.getAttribute("id"),
timestamp: way.getAttribute("timestamp"),
tags: tags
});
}
return ways;
}