import ScriptUtils from "./ScriptUtils" import { appendFileSync, readFileSync, writeFileSync } from "fs" import OsmObjectDownloader from "../Logic/Osm/OsmObjectDownloader" ScriptUtils.fixUtils() ScriptUtils.erasableLog("Fixing the cycle highways...") writeFileSync( "cycleHighwayFix.osc", '\n' + " ", "utf8" ) const ids = JSON.parse(readFileSync("export.geojson", "utf-8")).features.map( (f) => f.properties["@id"] ) console.log(ids) ids.map((id) => new OsmObjectDownloader().DownloadReferencingRelations(id).then((relations) => { console.log(relations) const changeparts = relations .filter( (relation) => relation.tags["cycle_highway"] == "yes" && relation.tags["note:state"] == undefined ) .map((relation) => { relation.tags["note:state"] = "has_highway_under_construction" return relation.ChangesetXML(undefined) }) appendFileSync("cycleHighwayFix.osc", changeparts.join("\n"), "utf8") }) )