chore: automated housekeeping...

This commit is contained in:
Pieter Vander Vennet 2024-08-09 16:55:08 +02:00
parent a8fd550b72
commit 6a0b77eb99
180 changed files with 16812 additions and 2509 deletions

View file

@ -24,7 +24,7 @@ export abstract class OsmObject {
// @ts-ignore
this.type = type
this.tags = {
id: `${this.type}/${id}`
id: `${this.type}/${id}`,
}
}
@ -55,7 +55,7 @@ export abstract class OsmObject {
const allGeojsons = OsmToGeoJson(
{ elements },
{
flatProperties: true
flatProperties: true,
}
)
const feature = allGeojsons.features.find(
@ -120,7 +120,7 @@ export abstract class OsmObject {
const blacklist = polygonFeature.polygon === "blacklist"
result.set(key, {
values: new Set<string>(polygonFeature.values),
blacklist: blacklist
blacklist: blacklist,
})
}
@ -151,7 +151,9 @@ export abstract class OsmObject {
}
const v = this.tags[key]
if (v !== "" && v !== undefined) {
tags += ` <tag k="${Utils.EncodeXmlValue(key)}" v="${Utils.EncodeXmlValue(this.tags[key])}"/>
tags += ` <tag k="${Utils.EncodeXmlValue(key)}" v="${Utils.EncodeXmlValue(
this.tags[key]
)}"/>
`
}
}
@ -212,7 +214,7 @@ export class OsmNode extends OsmObject {
ChangesetXML(changesetId: string, header?: string): string {
const tags = this.TagsXML()
return ` <node id="${this.id}" ${header ?? ""} ${
changesetId ? " changeset=\"" + changesetId + "\" " : ""
changesetId ? ' changeset="' + changesetId + '" ' : ""
}${this.VersionXML()} lat="${this.lat}" lon="${this.lon}">
${tags} </node>
`
@ -233,8 +235,8 @@ ${tags} </node>
properties: this.tags,
geometry: {
type: "Point",
coordinates: [this.lon, this.lat]
}
coordinates: [this.lon, this.lat],
},
}
}
}
@ -264,11 +266,11 @@ export class OsmWay extends OsmObject {
const tags = this.TagsXML()
let nds = ""
for (const node in this.nodes) {
nds += " <nd ref=\"" + this.nodes[node] + "\"/>\n"
nds += ' <nd ref="' + this.nodes[node] + '"/>\n'
}
return ` <way id="${this.id}" ${header ?? ""} ${
changesetId ? "changeset=\"" + changesetId + "\" " : ""
changesetId ? 'changeset="' + changesetId + '" ' : ""
} ${this.VersionXML()}>
${nds}${tags} </way>
`
@ -313,18 +315,18 @@ ${nds}${tags} </way>
if (this.isPolygon()) {
geometry = {
type: "Polygon",
coordinates: [coordinates]
coordinates: [coordinates],
}
} else {
geometry = {
type: "LineString",
coordinates: coordinates
coordinates: coordinates,
}
}
return {
type: "Feature",
properties: <any>this.tags,
geometry
geometry,
}
}