More work on splitting roads, WIP; refactoring tests

This commit is contained in:
Pieter Vander Vennet 2021-09-22 05:02:09 +02:00
parent e374bb355c
commit 1f93923820
62 changed files with 1163 additions and 823 deletions

View file

@ -10,7 +10,7 @@ writeFileSync("cycleHighwayFix.osc", "<osmChange version=\"0.6\" generator=\"Han
" <modify>", "utf8")
const ids = JSON.parse(readFileSync("export.geojson", "utf-8")).features.map(f => f.properties["@id"])
console.log(ids)
ids.map(id => OsmObject.DownloadReferencingRelations(id).addCallbackAndRunD(relations => {
ids.map(id => OsmObject.DownloadReferencingRelations(id).then(relations => {
console.log(relations)
const changeparts = relations.filter(relation => relation.tags["cycle_highway"] == "yes" && relation.tags["note:state"] == undefined)
.map(relation => {
@ -18,5 +18,4 @@ ids.map(id => OsmObject.DownloadReferencingRelations(id).addCallbackAndRunD(rela
return relation.ChangesetXML(undefined)
})
appendFileSync("cycleHighwayFix.osc", changeparts.join("\n"), "utf8")
return true;
}))

View file

@ -56,7 +56,7 @@ export default class ScriptUtils {
const headers = options?.headers ?? {}
headers.accept = "application/json"
console.log("Fetching", url)
const urlObj = new URL(url)
https.get({
host: urlObj.host,
@ -75,6 +75,7 @@ export default class ScriptUtils {
res.addListener('end', function () {
const result = parts.join("")
try {
console.log("Fetched", result)
resolve(JSON.parse(result))
} catch (e) {
console.error("Could not parse the following as JSON:", result)

View file

@ -201,7 +201,10 @@ function postProcess(allFeatures: FeatureSource, theme: LayoutConfig, relationsT
}
},
layer,
false);
{
includeDates: false,
includeNonDates: true
});
const createdTiles = []
// At this point, we have all the features of the entire area.