Scripts: reorder titles

This commit is contained in:
Pieter Vander Vennet 2025-07-11 20:51:58 +02:00
parent 6383311dc2
commit 03ae26103c
4 changed files with 30 additions and 25 deletions

View file

@ -24,14 +24,6 @@
},
"minzoom": 10,
"title": {
"mappings": [
{
"if": "name~*",
"then": {
"*": "{name}"
}
}
],
"render": {
"en": "Cinema",
"de": "Kino",
@ -41,7 +33,15 @@
"ca": "Cinema",
"cy": "Sinema",
"it": "Cinema"
}
},
"mappings": [
{
"if": "name~*",
"then": {
"*": "{name}"
}
}
]
},
"pointRendering": [
{

View file

@ -20,6 +20,14 @@
},
"minzoom": 12,
"title": {
"render": {
"en": "Tourist accomodation {name}",
"de": "Touristenunterkunft {name}",
"es": "Alojamiento turístico {name}",
"ca": "Allotjament turístic {name}",
"cs": "Turistická ubytovna {name}",
"it": "Struttura ricettiva turistica {name}"
},
"mappings": [
{
"if": "tourism=hotel",
@ -103,15 +111,7 @@
"cs": "Víkendový dům {name}"
}
}
],
"render": {
"en": "Tourist accomodation {name}",
"de": "Touristenunterkunft {name}",
"es": "Alojamiento turístico {name}",
"ca": "Allotjament turístic {name}",
"cs": "Turistická ubytovna {name}",
"it": "Struttura ricettiva turistica {name}"
}
]
},
"pointRendering": [
{

View file

@ -6,6 +6,10 @@
"cs": "Větrné pumpy"
},
"title": {
"render": {
"en": "Windpump {ref}",
"cs": "Větrná pumpa {ref}"
},
"mappings": [
{
"if": "name~*",
@ -14,11 +18,7 @@
"cs": "Větrná pumpa {ref}"
}
}
],
"render": {
"en": "Windpump {ref}",
"cs": "Větrná pumpa {ref}"
}
]
},
"pointRendering": [
{

View file

@ -1107,7 +1107,6 @@ export class OrderTagRendering extends DesugaringStep<TagRenderingConfigJson | s
if (typeof json !== "object") {
return json
}
console.log("Ordering", json.id, OrderTagRendering.tagRenderingAttributesOrder)
return Utils.reorder(json, OrderTagRendering.tagRenderingAttributesOrder)
}
@ -1129,10 +1128,16 @@ export class OrderLayer extends DesugaringStep<string | LayerConfigJson> {
if (typeof json === "string") {
return json
}
const orderTag = new OrderTagRendering()
// @ts-ignore
json = new On<"tagRenderings", TagRenderingConfigJson[], LayerConfigJson>("tagRenderings", new Each(
new OrderTagRendering(),
orderTag,
)).convert(<LayerConfigJson>json, context)
// @ts-ignore
json = new On("title", orderTag).convert(json, context)
return Utils.reorder(json, OrderLayer.layerAttributesOrder)
}
}