Merge master
This commit is contained in:
commit
51fa48a01f
151 changed files with 16260 additions and 1872 deletions
|
@ -43,10 +43,10 @@ class DownloadNsiLogos extends Script {
|
|||
await ScriptUtils.DownloadFileTo(logos.facebook, path)
|
||||
// Validate
|
||||
const content = readFileSync(path, "utf8")
|
||||
if(content.startsWith('{"error"')){
|
||||
if (content.startsWith('{"error"')) {
|
||||
unlinkSync(path)
|
||||
console.error("Attempted to fetch",logos.facebook," but this gave an error")
|
||||
}else{
|
||||
console.error("Attempted to fetch", logos.facebook, " but this gave an error")
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,7 +164,9 @@ export class GenerateFavouritesLayer extends Script {
|
|||
continue
|
||||
}
|
||||
if (optimized === false) {
|
||||
throw `Optimized ${TagUtils.Tag({or: conditions}).asHumanString()} into 'false', this is weird...`
|
||||
throw `Optimized ${TagUtils.Tag({
|
||||
or: conditions,
|
||||
}).asHumanString()} into 'false', this is weird...`
|
||||
}
|
||||
tr.condition = optimized
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ export class GenerateLicenseInfo extends Script {
|
|||
authors: ["Pieter Vander Vennet"],
|
||||
path: undefined,
|
||||
license: "CC0",
|
||||
sources: []
|
||||
sources: [],
|
||||
})
|
||||
knownLicenses.set("streetcomplete", {
|
||||
authors: ["Tobias Zwick (westnordost)"],
|
||||
|
@ -33,8 +33,8 @@ export class GenerateLicenseInfo extends Script {
|
|||
license: "CC0",
|
||||
sources: [
|
||||
"https://github.com/streetcomplete/StreetComplete/tree/master/res/graphics",
|
||||
"https://f-droid.org/packages/de.westnordost.streetcomplete/"
|
||||
]
|
||||
"https://f-droid.org/packages/de.westnordost.streetcomplete/",
|
||||
],
|
||||
})
|
||||
|
||||
knownLicenses.set("temaki", {
|
||||
|
@ -43,34 +43,34 @@ export class GenerateLicenseInfo extends Script {
|
|||
license: "CC0",
|
||||
sources: [
|
||||
"https://github.com/ideditor/temaki",
|
||||
"https://ideditor.github.io/temaki/docs/"
|
||||
]
|
||||
"https://ideditor.github.io/temaki/docs/",
|
||||
],
|
||||
})
|
||||
|
||||
knownLicenses.set("maki", {
|
||||
authors: ["Maki"],
|
||||
path: undefined,
|
||||
license: "CC0",
|
||||
sources: ["https://labs.mapbox.com/maki-icons/"]
|
||||
sources: ["https://labs.mapbox.com/maki-icons/"],
|
||||
})
|
||||
|
||||
knownLicenses.set("t", {
|
||||
authors: [],
|
||||
path: undefined,
|
||||
license: "CC0; trivial",
|
||||
sources: []
|
||||
sources: [],
|
||||
})
|
||||
knownLicenses.set("na", {
|
||||
authors: [],
|
||||
path: undefined,
|
||||
license: "CC0",
|
||||
sources: []
|
||||
sources: [],
|
||||
})
|
||||
knownLicenses.set("carto", {
|
||||
authors: ["OSM-Carto"],
|
||||
path: undefined,
|
||||
license: "CC0",
|
||||
sources: [""]
|
||||
sources: [""],
|
||||
})
|
||||
knownLicenses.set("tv", {
|
||||
authors: ["Toerisme Vlaanderen"],
|
||||
|
@ -78,20 +78,20 @@ export class GenerateLicenseInfo extends Script {
|
|||
license: "CC0",
|
||||
sources: [
|
||||
"https://toerismevlaanderen.be/pinjepunt",
|
||||
"https://mapcomplete.org/toerisme_vlaanderenn"
|
||||
]
|
||||
"https://mapcomplete.org/toerisme_vlaanderenn",
|
||||
],
|
||||
})
|
||||
knownLicenses.set("tvf", {
|
||||
authors: ["Jo De Baerdemaeker "],
|
||||
path: undefined,
|
||||
license: "All rights reserved",
|
||||
sources: ["https://www.studiotype.be/fonts/flandersart"]
|
||||
sources: ["https://www.studiotype.be/fonts/flandersart"],
|
||||
})
|
||||
knownLicenses.set("twemoji", {
|
||||
authors: ["Twemoji"],
|
||||
path: undefined,
|
||||
license: "CC-BY 4.0",
|
||||
sources: ["https://github.com/twitter/twemoji"]
|
||||
sources: ["https://github.com/twitter/twemoji"],
|
||||
})
|
||||
return knownLicenses
|
||||
}
|
||||
|
@ -147,36 +147,39 @@ export class GenerateLicenseInfo extends Script {
|
|||
const svg = await ScriptUtils.ReadSvg(icon)
|
||||
|
||||
const colours = new Set<string>()
|
||||
Utils.WalkObject(svg, leaf => {
|
||||
const style = leaf["style"].split(";")
|
||||
for (const styleElement of style) {
|
||||
const [key, value] = styleElement.split(":").map(x => x.trim())
|
||||
if (value === "none") {
|
||||
continue
|
||||
Utils.WalkObject(
|
||||
svg,
|
||||
(leaf) => {
|
||||
const style = leaf["style"].split(";")
|
||||
for (const styleElement of style) {
|
||||
const [key, value] = styleElement.split(":").map((x) => x.trim())
|
||||
if (value === "none") {
|
||||
continue
|
||||
}
|
||||
if (key === "fill" || key === "stroke") {
|
||||
colours.add(value)
|
||||
}
|
||||
return colours
|
||||
}
|
||||
if (key === "fill" || key === "stroke") {
|
||||
colours.add(value)
|
||||
}
|
||||
return colours
|
||||
}
|
||||
}, leaf => typeof leaf["style"] === "string" )
|
||||
if(colours.size === 0){
|
||||
},
|
||||
(leaf) => typeof leaf["style"] === "string"
|
||||
)
|
||||
if (colours.size === 0) {
|
||||
continue
|
||||
}
|
||||
const whiteColours = Array.from(colours).map(c => {
|
||||
const whiteColours = Array.from(colours).map((c) => {
|
||||
const rgb = Utils.color(c)
|
||||
if(!rgb){
|
||||
if (!rgb) {
|
||||
console.log("Could not parse ", c)
|
||||
return false
|
||||
}
|
||||
const {r,g,b} = rgb
|
||||
return (r > 245 && g > 245 && b > 245)
|
||||
const { r, g, b } = rgb
|
||||
return r > 245 && g > 245 && b > 245
|
||||
})
|
||||
const hasDark = whiteColours.some(isWhite => !isWhite)
|
||||
if(!hasDark){
|
||||
const hasDark = whiteColours.some((isWhite) => !isWhite)
|
||||
if (!hasDark) {
|
||||
whitePaths.add(icon)
|
||||
}
|
||||
|
||||
}
|
||||
return whitePaths
|
||||
}
|
||||
|
@ -228,7 +231,7 @@ export class GenerateLicenseInfo extends Script {
|
|||
authors: author.split(";"),
|
||||
path: path,
|
||||
license: prompt("What is the license for artwork " + path + "? > "),
|
||||
sources: prompt("Where was this artwork found? > ").split(";")
|
||||
sources: prompt("Where was this artwork found? > ").split(";"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -261,7 +264,7 @@ export class GenerateLicenseInfo extends Script {
|
|||
"ISC-LICENSE": "ISC",
|
||||
"LOGO-BY-THE-GOVERNMENT": "LOGO",
|
||||
PD: "PUBLIC-DOMAIN",
|
||||
"LOGO-(ALL-RIGHTS-RESERVED)": "LOGO"
|
||||
"LOGO-(ALL-RIGHTS-RESERVED)": "LOGO",
|
||||
/* ALL-RIGHTS-RESERVED:
|
||||
PD:
|
||||
PUBLIC-DOMAIN:
|
||||
|
@ -292,7 +295,7 @@ export class GenerateLicenseInfo extends Script {
|
|||
path: license.path,
|
||||
license: license.license,
|
||||
authors: license.authors,
|
||||
sources: license.sources
|
||||
sources: license.sources,
|
||||
}
|
||||
|
||||
cloned.license = Utils.Dedup(
|
||||
|
@ -335,7 +338,7 @@ export class GenerateLicenseInfo extends Script {
|
|||
}
|
||||
|
||||
queryMissingLicenses(missingLicenses: string[]) {
|
||||
process.on("SIGINT", function() {
|
||||
process.on("SIGINT", function () {
|
||||
console.log("Aborting... Bye!")
|
||||
process.exit()
|
||||
})
|
||||
|
@ -373,7 +376,7 @@ export class GenerateLicenseInfo extends Script {
|
|||
licensePath.length - "license_info.json".length
|
||||
)
|
||||
license.path = dir + license.path
|
||||
if(mostlyWhite.some(l => license.path === l)){
|
||||
if (mostlyWhite.some((l) => license.path === l)) {
|
||||
license["mostly_white"] = true
|
||||
}
|
||||
allLicenses.push(license)
|
||||
|
@ -421,7 +424,7 @@ export class GenerateLicenseInfo extends Script {
|
|||
if (licenseInfo.sources.length + licenseInfo.authors.length == 0 && !isTrivial) {
|
||||
invalidLicenses.push(
|
||||
"Invalid license: No sources nor authors given in the license for " +
|
||||
JSON.stringify(licenseInfo)
|
||||
JSON.stringify(licenseInfo)
|
||||
)
|
||||
continue
|
||||
}
|
||||
|
@ -444,10 +447,10 @@ export class GenerateLicenseInfo extends Script {
|
|||
const spdxContent = [
|
||||
"SPDX-FileCopyrightText: " + licenseInfo.authors.join("; "),
|
||||
"SPDX-License-Identifier: " +
|
||||
licenseInfo.license
|
||||
.split(" AND ")
|
||||
.map((s) => this.addLicenseRef(s))
|
||||
.join(" AND ")
|
||||
licenseInfo.license
|
||||
.split(" AND ")
|
||||
.map((s) => this.addLicenseRef(s))
|
||||
.join(" AND "),
|
||||
]
|
||||
writeFileSync(spdxPath, spdxContent.join("\n"))
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import { OsmObject } from "../src/Logic/Osm/OsmObject"
|
|||
import OsmObjectDownloader from "../src/Logic/Osm/OsmObjectDownloader"
|
||||
import { OsmConnection } from "../src/Logic/Osm/OsmConnection"
|
||||
import { ImmutableStore } from "../src/Logic/UIEventSource"
|
||||
import { Utils } from "../src/Utils"
|
||||
import Constants from "../src/Models/Constants"
|
||||
|
||||
type ErrorMessage = {
|
||||
|
@ -30,10 +29,6 @@ class HandleErrors extends Script {
|
|||
super("Inspects the errors made on a given day. Argument: path to errors")
|
||||
}
|
||||
|
||||
parseLine() {
|
||||
|
||||
}
|
||||
|
||||
async main(args: string[]): Promise<void> {
|
||||
const osmConnection = new OsmConnection()
|
||||
const downloader = new OsmObjectDownloader(osmConnection.Backend(), undefined)
|
||||
|
@ -45,10 +40,14 @@ class HandleErrors extends Script {
|
|||
const refusedFiles: Set<string> = new Set<string>()
|
||||
refusedFiles.add("[]")
|
||||
|
||||
const changesObj = new Changes({
|
||||
dryRun: new ImmutableStore(true),
|
||||
osmConnection,
|
||||
}, false, err => console.error(err))
|
||||
const changesObj = new Changes(
|
||||
{
|
||||
dryRun: new ImmutableStore(true),
|
||||
osmConnection,
|
||||
},
|
||||
false,
|
||||
(err) => console.error(err)
|
||||
)
|
||||
|
||||
const all: ErrorMessage[] = []
|
||||
for (const line of lines) {
|
||||
|
@ -67,11 +66,10 @@ class HandleErrors extends Script {
|
|||
console.log(
|
||||
"\t https://osm.org/" + pendingChange.type + "/" + pendingChange.id,
|
||||
pendingChange.meta.changeType,
|
||||
pendingChange.doDelete ? "DELETE" : "",
|
||||
pendingChange.doDelete ? "DELETE" : ""
|
||||
)
|
||||
}
|
||||
all.push(parsed)
|
||||
|
||||
} catch (e) {
|
||||
console.log("Parsing line failed:", e)
|
||||
}
|
||||
|
@ -81,16 +79,15 @@ class HandleErrors extends Script {
|
|||
const e = parsed.message
|
||||
const neededIds = Changes.GetNeededIds(e.pendingChanges)
|
||||
// We _do not_ pass in the Changes object itself - we want the data from OSM directly in order to apply the changes
|
||||
const osmObjects: { id: string; osmObj: OsmObject | "deleted" }[] =
|
||||
await Promise.all<{
|
||||
id: string
|
||||
osmObj: OsmObject | "deleted"
|
||||
}>(
|
||||
neededIds.map(async (id) => ({
|
||||
id,
|
||||
osmObj: await downloader.DownloadObjectAsync(id),
|
||||
})),
|
||||
)
|
||||
const osmObjects: { id: string; osmObj: OsmObject | "deleted" }[] = await Promise.all<{
|
||||
id: string
|
||||
osmObj: OsmObject | "deleted"
|
||||
}>(
|
||||
neededIds.map(async (id) => ({
|
||||
id,
|
||||
osmObj: await downloader.DownloadObjectAsync(id),
|
||||
}))
|
||||
)
|
||||
|
||||
const objects = osmObjects
|
||||
.filter((obj) => obj.osmObj !== "deleted")
|
||||
|
@ -115,15 +112,13 @@ class HandleErrors extends Script {
|
|||
`<osmChange version='0.6' generator='Mapcomplete ${Constants.vNumber}'></osmChange>`
|
||||
) {
|
||||
console.log(
|
||||
"Changes for " +
|
||||
parsed.index +
|
||||
": empty changeset, not creating a file for it",
|
||||
"Changes for " + parsed.index + ": empty changeset, not creating a file for it"
|
||||
)
|
||||
} else if (createdChangesets.has(changeset)) {
|
||||
console.log(
|
||||
"Changeset " +
|
||||
parsed.index +
|
||||
" is identical to previously seen changeset, not writing to file",
|
||||
parsed.index +
|
||||
" is identical to previously seen changeset, not writing to file"
|
||||
)
|
||||
} else {
|
||||
writeFileSync(path, changeset, "utf8")
|
||||
|
@ -133,21 +128,16 @@ class HandleErrors extends Script {
|
|||
if (refusedFiles.has(refusedContent)) {
|
||||
console.log(
|
||||
"Refused changes for " +
|
||||
parsed.index +
|
||||
" is identical to previously seen changeset, not writing to file",
|
||||
parsed.index +
|
||||
" is identical to previously seen changeset, not writing to file"
|
||||
)
|
||||
} else {
|
||||
writeFileSync(path + ".refused.json", refusedContent, "utf8")
|
||||
refusedFiles.add(refusedContent)
|
||||
}
|
||||
console.log("Written", path, "with " + e.pendingChanges.length + " changes")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new
|
||||
|
||||
HandleErrors()
|
||||
|
||||
.run()
|
||||
new HandleErrors().run()
|
||||
|
|
|
@ -15,12 +15,10 @@ import { TagUtils } from "../../src/Logic/Tags/TagUtils"
|
|||
import { BBox } from "../../src/Logic/BBox"
|
||||
|
||||
export default class CleanRepair extends Script {
|
||||
|
||||
constructor() {
|
||||
super("Cleans 'repair'-tags for mass retagging")
|
||||
}
|
||||
|
||||
|
||||
async main(args: string[]) {
|
||||
const path = args[0]
|
||||
console.log("Loading", path)
|
||||
|
@ -32,141 +30,244 @@ export default class CleanRepair extends Script {
|
|||
"repair!=brand",
|
||||
"repair!=only",
|
||||
"repair!=only_sold",
|
||||
"repair!=assisted_self_service"
|
||||
]
|
||||
"repair!=assisted_self_service",
|
||||
],
|
||||
})
|
||||
const overpass = new Overpass(criteria, [],
|
||||
"https://overpass-api.de/api/interpreter"
|
||||
)
|
||||
const data: Feature<Geometry, Record<string, string>> [] = (await overpass.queryGeoJson(BBox.global))[0].features
|
||||
const overpass = new Overpass(criteria, [], "https://overpass-api.de/api/interpreter")
|
||||
const data: Feature<Geometry, Record<string, string>>[] = (
|
||||
await overpass.queryGeoJson(BBox.global)
|
||||
)[0].features
|
||||
console.log("Got", data.length, "features; sample", data[0])
|
||||
const changes = new Changes({
|
||||
dryRun: new ImmutableStore(true),
|
||||
osmConnection: new OsmConnection({
|
||||
dryRun: new ImmutableStore(true)
|
||||
})
|
||||
dryRun: new ImmutableStore(true),
|
||||
}),
|
||||
})
|
||||
|
||||
const metakeys = ["id", "version", "changeset", "user", "uid", "timestamp"]
|
||||
|
||||
const replace = {
|
||||
"phone": "mobile_phone",
|
||||
"phones": "mobile_phone",
|
||||
"mobile": "mobile_phone",
|
||||
"cellphone": "mobile_phone",
|
||||
"pc": "computers",
|
||||
"mobile_phones": "mobile_phone",
|
||||
"mobilephones": "mobile_phone",
|
||||
"mobilephone": "mobile_phone",
|
||||
"clocks": "clock",
|
||||
"elektronik": "electronics",
|
||||
"tires": "tyres",
|
||||
"welcome": "yes",
|
||||
"tyre": "tyres",
|
||||
"electronic_products": "electronics",
|
||||
"shoe": "shoes",
|
||||
"pc_repairs": "computer",
|
||||
"computers": "computer",
|
||||
"body_construction": "body_work",
|
||||
"body": "body_work",
|
||||
phone: "mobile_phone",
|
||||
phones: "mobile_phone",
|
||||
mobile: "mobile_phone",
|
||||
cellphone: "mobile_phone",
|
||||
pc: "computers",
|
||||
mobile_phones: "mobile_phone",
|
||||
mobilephones: "mobile_phone",
|
||||
mobilephone: "mobile_phone",
|
||||
clocks: "clock",
|
||||
elektronik: "electronics",
|
||||
tires: "tyres",
|
||||
welcome: "yes",
|
||||
tyre: "tyres",
|
||||
electronic_products: "electronics",
|
||||
shoe: "shoes",
|
||||
pc_repairs: "computer",
|
||||
computers: "computer",
|
||||
body_construction: "body_work",
|
||||
body: "body_work",
|
||||
|
||||
"body_repairer": "body_work",
|
||||
"instruments": "musical_instrument",
|
||||
"service": "yes",
|
||||
"punture": "tyres",
|
||||
"electricity": "electronics",
|
||||
"self_service": "assisted_self_repair",
|
||||
"paint": "bodywork",
|
||||
body_repairer: "body_work",
|
||||
instruments: "musical_instrument",
|
||||
service: "yes",
|
||||
punture: "tyres",
|
||||
electricity: "electronics",
|
||||
self_service: "assisted_self_repair",
|
||||
paint: "bodywork",
|
||||
"paint shop": "bodywork",
|
||||
"paint_shop": "bodywork",
|
||||
"lawnmower": "lawn_mower",
|
||||
"aircon": "air_conditioning",
|
||||
paint_shop: "bodywork",
|
||||
lawnmower: "lawn_mower",
|
||||
aircon: "air_conditioning",
|
||||
"*": "yes",
|
||||
"ammeublement": "furniture",
|
||||
"all": "yes",
|
||||
"appliances": "appliance",
|
||||
"electronic": "electronics", "escooter": "electric_scooter",
|
||||
ammeublement: "furniture",
|
||||
all: "yes",
|
||||
appliances: "appliance",
|
||||
electronic: "electronics",
|
||||
escooter: "electric_scooter",
|
||||
"aviation maintenance, repair, and_overhaul": "airplane",
|
||||
"aviation_maintenance": "airplanes",
|
||||
"bags": "bag",
|
||||
"boats": "boat",
|
||||
"boilers": "boiler",
|
||||
"breaks": "brakes",
|
||||
"car": "cars",
|
||||
"tv": "television",
|
||||
"clothing": "clothes",
|
||||
"coat_of_lacquer": "body_work",
|
||||
"cycle": "bicycle",
|
||||
"cars": "car",
|
||||
"blacharstwo": "tin", "lakiernictwo": "body_work",
|
||||
"tire": "tyres", "powder_coating": "body_work",
|
||||
"leather_products": "leather",
|
||||
"motocycle": "motorcycle",
|
||||
"motor": "motorcycle", "motoo": "motorcycle",
|
||||
"motorbike": "motorcycle", "motorcycle_repair": "motorcycle", "motorsports": "motorcycle",
|
||||
"printers": "printer",
|
||||
"tyres24": "tyres",
|
||||
"paintings": "painting",
|
||||
"paintwork": "body_work",
|
||||
"pumps": "pump",
|
||||
aviation_maintenance: "airplanes",
|
||||
bags: "bag",
|
||||
boats: "boat",
|
||||
boilers: "boiler",
|
||||
breaks: "brakes",
|
||||
car: "cars",
|
||||
tv: "television",
|
||||
clothing: "clothes",
|
||||
coat_of_lacquer: "body_work",
|
||||
cycle: "bicycle",
|
||||
cars: "car",
|
||||
blacharstwo: "tin",
|
||||
lakiernictwo: "body_work",
|
||||
tire: "tyres",
|
||||
powder_coating: "body_work",
|
||||
leather_products: "leather",
|
||||
motocycle: "motorcycle",
|
||||
motor: "motorcycle",
|
||||
motoo: "motorcycle",
|
||||
motorbike: "motorcycle",
|
||||
motorcycle_repair: "motorcycle",
|
||||
motorsports: "motorcycle",
|
||||
printers: "printer",
|
||||
tyres24: "tyres",
|
||||
paintings: "painting",
|
||||
paintwork: "body_work",
|
||||
pumps: "pump",
|
||||
"shoes:yes": "shoes",
|
||||
"wheel": "tyres",
|
||||
"wheels": "tyres",
|
||||
"vacuum": "vacuum_cleaner",
|
||||
"glass": "car_glassj"
|
||||
wheel: "tyres",
|
||||
wheels: "tyres",
|
||||
vacuum: "vacuum_cleaner",
|
||||
glass: "car_glassj",
|
||||
}
|
||||
|
||||
const brands = ["garage", "audi", "renault", "apple", "honda", "ducati", "ford", "mazda","garage_renault_aie"]
|
||||
const brands = [
|
||||
"garage",
|
||||
"audi",
|
||||
"renault",
|
||||
"apple",
|
||||
"honda",
|
||||
"ducati",
|
||||
"ford",
|
||||
"mazda",
|
||||
"garage_renault_aie",
|
||||
]
|
||||
|
||||
const valid = ["train", "tv", "jewelry", "scooter", ...Object.values(replace), "watch", "oldtimer", "car", "bicycle", "boat", "windbreaker",
|
||||
"agricultural", "alternator", "antiques", "atv", "auto",
|
||||
"aviation maintenance", "bag", "bags",
|
||||
"battery", "bicyle", "borehole", "building",
|
||||
"camera", "car_glass", "caravan",
|
||||
"carpenter", "coffee_machine", "construction machinery", "cycle",
|
||||
"dentures", "ducati", "electric motor",
|
||||
"electric_bike", "electric_scooter", "espresso_machines", "exhaust",
|
||||
"fire_extinguishers", "fountain_pen", "fridge",
|
||||
"garden_machinery", "gas appliances", "generator",
|
||||
"glasses", "golfcart", "guitar",
|
||||
"hammock", "hardware", "heating pumps",
|
||||
"hifi", "hvac", "installation", "jewellery", "keys", "kick_scooter",
|
||||
"kitesurfing", "tools", "toys", "tractor",
|
||||
"trailer", "transformer", "truck",
|
||||
"typewriter", "sail", "sewing_machine", "ship", "picture", "pillow", "plastic",
|
||||
"cash_register", "cnc", "laptop",
|
||||
const valid = [
|
||||
"train",
|
||||
"tv",
|
||||
"jewelry",
|
||||
"scooter",
|
||||
...Object.values(replace),
|
||||
"watch",
|
||||
"oldtimer",
|
||||
"car",
|
||||
"bicycle",
|
||||
"boat",
|
||||
"windbreaker",
|
||||
"agricultural",
|
||||
"alternator",
|
||||
"antiques",
|
||||
"atv",
|
||||
"auto",
|
||||
"aviation maintenance",
|
||||
"bag",
|
||||
"bags",
|
||||
"battery",
|
||||
"bicyle",
|
||||
"borehole",
|
||||
"building",
|
||||
"camera",
|
||||
"car_glass",
|
||||
"caravan",
|
||||
"carpenter",
|
||||
"coffee_machine",
|
||||
"construction machinery",
|
||||
"cycle",
|
||||
"dentures",
|
||||
"ducati",
|
||||
"electric motor",
|
||||
"electric_bike",
|
||||
"electric_scooter",
|
||||
"espresso_machines",
|
||||
"exhaust",
|
||||
"fire_extinguishers",
|
||||
"fountain_pen",
|
||||
"fridge",
|
||||
"garden_machinery",
|
||||
"gas appliances",
|
||||
"generator",
|
||||
"glasses",
|
||||
"golfcart",
|
||||
"guitar",
|
||||
"hammock",
|
||||
"hardware",
|
||||
"heating pumps",
|
||||
"hifi",
|
||||
"hvac",
|
||||
"installation",
|
||||
"jewellery",
|
||||
"keys",
|
||||
"kick_scooter",
|
||||
"kitesurfing",
|
||||
"tools",
|
||||
"toys",
|
||||
"tractor",
|
||||
"trailer",
|
||||
"transformer",
|
||||
"truck",
|
||||
"typewriter",
|
||||
"sail",
|
||||
"sewing_machine",
|
||||
"ship",
|
||||
"picture",
|
||||
"pillow",
|
||||
"plastic",
|
||||
"cash_register",
|
||||
"cnc",
|
||||
"laptop",
|
||||
"laundry_machines",
|
||||
"photo_camera", "photocopier", "piano",
|
||||
"power_tools", "pressure_gauges", "printer",
|
||||
, "snowboard", "snowmobile", "starter", "machines", "mainframe",
|
||||
"photo_camera",
|
||||
"photocopier",
|
||||
"piano",
|
||||
"power_tools",
|
||||
"pressure_gauges",
|
||||
"printer",
|
||||
,
|
||||
"snowboard",
|
||||
"snowmobile",
|
||||
"starter",
|
||||
"machines",
|
||||
"mainframe",
|
||||
"outboard_motor",
|
||||
"video", "washing_machine", "ski", "radiator",
|
||||
"radio", "refrigerator",
|
||||
"rv", "ski", "window", "zipper", "weighing_scale",
|
||||
"small_electric_vehicle"
|
||||
|
||||
].map(s => s.replace(/ /g, "_"))
|
||||
|
||||
"video",
|
||||
"washing_machine",
|
||||
"ski",
|
||||
"radiator",
|
||||
"radio",
|
||||
"refrigerator",
|
||||
"rv",
|
||||
"ski",
|
||||
"window",
|
||||
"zipper",
|
||||
"weighing_scale",
|
||||
"small_electric_vehicle",
|
||||
].map((s) => s.replace(/ /g, "_"))
|
||||
|
||||
const skip = ["yes", "no", "only", "brand", "assisted_self_repair", "only_sold"]
|
||||
const dloader = new OsmObjectDownloader()
|
||||
const rm = ["50243147100015", "81342677200048", "and overhaul", "repair", "unset", "сервисный_центр", "taller_de_michu", "quitandinha_g_&_a", "mechanika"].map(v => v.replace(/ /g, "_"))
|
||||
const rm = [
|
||||
"50243147100015",
|
||||
"81342677200048",
|
||||
"and overhaul",
|
||||
"repair",
|
||||
"unset",
|
||||
"сервисный_центр",
|
||||
"taller_de_michu",
|
||||
"quitandinha_g_&_a",
|
||||
"mechanika",
|
||||
].map((v) => v.replace(/ /g, "_"))
|
||||
const objects: OsmObject[] = []
|
||||
const changesToMake: ChangeDescription [] = []
|
||||
const changesToMake: ChangeDescription[] = []
|
||||
const first = GeoOperations.centerpointCoordinates(data[0])
|
||||
for (const f of data) {
|
||||
if (GeoOperations.distanceBetween(first, GeoOperations.centerpointCoordinates(f)) > 2500000) {
|
||||
if (
|
||||
GeoOperations.distanceBetween(first, GeoOperations.centerpointCoordinates(f)) >
|
||||
2500000
|
||||
) {
|
||||
continue
|
||||
}
|
||||
let keyRaw = f.properties.repair
|
||||
keyRaw = replace[keyRaw] ?? keyRaw
|
||||
if (brands.some(br => keyRaw.toLowerCase().indexOf(br.trim()) >= 0)) {
|
||||
if (brands.some((br) => keyRaw.toLowerCase().indexOf(br.trim()) >= 0)) {
|
||||
f.properties.repair = "brand"
|
||||
} if(skip.indexOf(keyRaw) >= 0){
|
||||
}
|
||||
if (skip.indexOf(keyRaw) >= 0) {
|
||||
f.properties.repair = keyRaw
|
||||
} else {
|
||||
|
||||
const r = keyRaw.replace(/\/|,/g, ";").split(";").map(k => k.trim().replace(/ /g, "_").toLowerCase())
|
||||
const r = keyRaw
|
||||
.replace(/\/|,/g, ";")
|
||||
.split(";")
|
||||
.map((k) => k.trim().replace(/ /g, "_").toLowerCase())
|
||||
for (let key of r) {
|
||||
key = replace[key] ?? key
|
||||
|
||||
|
@ -177,9 +278,7 @@ export default class CleanRepair extends Script {
|
|||
|
||||
f.properties[key + ":repair"] = "yes"
|
||||
delete f.properties.repair
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (f.properties.service === "repair") {
|
||||
delete f.properties.service
|
||||
|
@ -198,34 +297,25 @@ export default class CleanRepair extends Script {
|
|||
const value = f.properties[key]
|
||||
const ct = await new ChangeTagAction(id, new Tag(key, value), f.properties, {
|
||||
changeType: "fix",
|
||||
theme: "script"
|
||||
theme: "script",
|
||||
}).CreateChangeDescriptions()
|
||||
changesToMake.push(...ct)
|
||||
console.log(ct.map(cd => cd.tags))
|
||||
console.log(ct.map((cd) => cd.tags))
|
||||
if (f.properties.repair === undefined) {
|
||||
const ct = await new ChangeTagAction(id, new Tag("repair", ""), f.properties, {
|
||||
changeType: "fix",
|
||||
theme: "script"
|
||||
theme: "script",
|
||||
}).CreateChangeDescriptions()
|
||||
changesToMake.push(...ct)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const
|
||||
changedObjects = changes.CreateChangesetObjects(changesToMake, objects)
|
||||
const changedObjects = changes.CreateChangesetObjects(changesToMake, objects)
|
||||
|
||||
const
|
||||
osc = Changes.createChangesetFor("", changedObjects)
|
||||
|
||||
writeFileSync(
|
||||
"Cleanup.osc"
|
||||
,
|
||||
osc
|
||||
,
|
||||
"utf8"
|
||||
)
|
||||
const osc = Changes.createChangesetFor("", changedObjects)
|
||||
|
||||
writeFileSync("Cleanup.osc", osc, "utf8")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ class IdThief {
|
|||
continue
|
||||
}
|
||||
|
||||
if(preset.tags["shop"] === "vacant") {
|
||||
if (preset.tags["shop"] === "vacant") {
|
||||
console.log("Skipping 'vacant'")
|
||||
continue
|
||||
}
|
||||
|
@ -282,15 +282,15 @@ class IdThief {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class ReadIdPresets extends Script{
|
||||
class ReadIdPresets extends Script {
|
||||
constructor() {
|
||||
super("Reads the id-tagging-schema repository and steals the presets; which will be written into 'id_presets.json'\n\nArguments: [path-to-repository] [path-to-target]\n" +
|
||||
"Note that default arguments are used")
|
||||
super(
|
||||
"Reads the id-tagging-schema repository and steals the presets; which will be written into 'id_presets.json'\n\nArguments: [path-to-repository] [path-to-target]\n" +
|
||||
"Note that default arguments are used"
|
||||
)
|
||||
}
|
||||
|
||||
async main(args: string[]): Promise<void> {
|
||||
|
||||
const targetDir = args[1] ?? "./assets/layers/id_presets/"
|
||||
|
||||
const makiThief = new MakiThief(
|
||||
|
@ -345,9 +345,7 @@ class ReadIdPresets extends Script{
|
|||
]
|
||||
console.log("Writing id presets to", id_presets_path)
|
||||
writeFileSync(id_presets_path, JSON.stringify(idPresets, null, " "), "utf8")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
new ReadIdPresets().run()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue