Fix various small issues to the teams, add some more validation

This commit is contained in:
pietervdvn 2022-07-20 22:57:39 +02:00
parent a4b51b63ca
commit f63f62922e
14 changed files with 65 additions and 12 deletions

View file

@ -521,8 +521,13 @@ export class ValidateLayer extends DesugaringStep<LayerConfigJson> {
} }
} }
if(json.title === undefined && json.tagRenderings !== undefined){ if(json.tagRenderings !== undefined && json.tagRenderings.length > 0){
warnings.push(context + ": this layer does not have a title defined but it does have tagRenderings. Not having a title will disable the popups, resulting in an unclickable element.") if(json.title === undefined){
errors.push(context + ": this layer does not have a title defined but it does have tagRenderings. Not having a title will disable the popups, resulting in an unclickable element. Please add a title. If not having a popup is intended and the tagrenderings need to be kept (e.g. in a library layer), set `title: null` to disable this error.")
}
if(json.title === null){
information.push(context + ": title is `null`. This results in an element that cannot be clicked - even though tagRenderings is set.")
}
} }
if (json["builtin"] !== undefined) { if (json["builtin"] !== undefined) {

View file

@ -7,6 +7,9 @@
"osmTags": "highway=elevator" "osmTags": "highway=elevator"
}, },
"minzoom": 13, "minzoom": 13,
"description": {
"en": "This layer show elevators and asks for operational status and elevator dimensions. Useful for wheelchair accessibility information"
},
"title": { "title": {
"en": "Elevator" "en": "Elevator"
}, },
@ -22,7 +25,15 @@
"if": "operational_status=broken", "if": "operational_status=broken",
"then": { "then": {
"en": "This elevator is broken" "en": "This elevator is broken"
} },
"icon": "close:red"
},
{
"if": "operational_status=closed",
"then": {
"en": "This elevator is closed <span class='subtle'>e.g. because renovation works are going on</span>"
},
"icon": "invalid:red"
}, },
{ {
"if": "operational_status=ok", "if": "operational_status=ok",
@ -89,6 +100,17 @@
"location": [ "location": [
"point", "point",
"centroid" "centroid"
],
"iconBadges": [
{
"if": {
"or": [
"operational_status=broken",
"operational_status=closed"
]
},
"then": "close:#c33"
}
] ]
} }
], ],
@ -121,6 +143,7 @@
} }
}, },
{ {
"default": true,
"canonicalDenomination": "cm", "canonicalDenomination": "cm",
"alternativeDenomination": [ "alternativeDenomination": [
"centimeter", "centimeter",

View file

@ -337,8 +337,7 @@
"es": "¿Cual es el ancho de esta puerta/entrada?" "es": "¿Cual es el ancho de esta puerta/entrada?"
}, },
"freeform": { "freeform": {
"key": "width", "key": "width"
"type": "distance"
} }
}, },
{ {
@ -417,6 +416,7 @@
} }
}, },
{ {
"default": true,
"canonicalDenomination": "cm", "canonicalDenomination": "cm",
"alternativeDenomination": [ "alternativeDenomination": [
"centimeter", "centimeter",

View file

@ -3,6 +3,9 @@
"name": { "name": {
"en": "governments" "en": "governments"
}, },
"description": {
"en": "This layer show governmental buildings. It was setup as commissioned layer for the client of OSOC '22"
},
"source": { "source": {
"osmTags": { "osmTags": {
"or": [ "or": [

View file

@ -8,6 +8,9 @@
"en": "Hospital" "en": "Hospital"
} }
}, },
"description": {
"en": "A layer showing hospital grounds"
},
"minzoom": 12, "minzoom": 12,
"source": { "source": {
"osmTags": "amenity=hospital" "osmTags": "amenity=hospital"
@ -39,6 +42,10 @@
"point", "point",
"centroid" "centroid"
] ]
},
{
"color": "#fcd862",
"width": 1
} }
] ]
} }

View file

@ -1,10 +1,13 @@
{ {
"id": "id_presets", "id": "id_presets",
"description": "Layer containing various presets and questions generated by ID. These are meant to be reused in other layers by importing the tagRenderings with `id_preset.<tagrendering>", "description": {
"en": "Layer containing various presets and questions generated by ID. These are meant to be reused in other layers by importing the tagRenderings with `id_preset.<tagrendering>"
},
"#dont-translate": "*", "#dont-translate": "*",
"source": { "source": {
"osmTags": "id~*" "osmTags": "id~*"
}, },
"title": null,
"mapRendering": null, "mapRendering": null,
"tagRenderings": [ "tagRenderings": [
{ {

View file

@ -3,6 +3,9 @@
"name": { "name": {
"en": "indoors" "en": "indoors"
}, },
"description": {
"en": "Basic indoor mapping: shows room outlines"
},
"source": { "source": {
"osmTags": { "osmTags": {
"or": [ "or": [

View file

@ -3,6 +3,9 @@
"name": { "name": {
"en": "pharmacy" "en": "pharmacy"
}, },
"description": {
"en": "A layer showing pharmacies, which (probably) dispense prescription drugs"
},
"title": { "title": {
"render": { "render": {
"en": "{name}" "en": "{name}"

View file

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="500" height="500" viewBox="0 0 14 14"> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="500" height="500" viewBox="0 0 14 14">
<rect width="14" height="14" x="0" y="0" id="canvas" style="fill:none;stroke:none;visibility:hidden"/>
<path d="m 4,4 -2,2 0,8 10,0 0,-8 -2,-2.0000003 z m 2,2 2,0 0,2 2,0 0,2 -2,0 0,2 -2,0 0,-2 -2,0 0,-2 2,0 z M 4,0 4,3 10,3 10,0 z" id="pharmacy" style="fill:#BF0000"/> <path d="m 4,4 -2,2 0,8 10,0 0,-8 -2,-2.0000003 z m 2,2 2,0 0,2 2,0 0,2 -2,0 0,2 -2,0 0,-2 -2,0 0,-2 2,0 z M 4,0 4,3 10,3 10,0 z" id="pharmacy" style="fill:#BF0000"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 493 B

After

Width:  |  Height:  |  Size: 330 B

View file

@ -3,6 +3,9 @@
"name": { "name": {
"en": "Reception desks" "en": "Reception desks"
}, },
"description": {
"en": "A layer showing where the reception desks are and which asks some accessibility information"
},
"title": { "title": {
"render": { "render": {
"en": "Reception desk" "en": "Reception desk"

View file

@ -5,6 +5,7 @@
"source": { "source": {
"osmTags": "id~*" "osmTags": "id~*"
}, },
"title": null,
"mapRendering": null, "mapRendering": null,
"tagRenderings": [ "tagRenderings": [
{ {

View file

@ -33,6 +33,7 @@
"layers": [ "layers": [
{ {
"id": "shadow", "id": "shadow",
"title": null,
"source": { "source": {
"geoJson": "https://raw.githubusercontent.com/pietervdvn/MapComplete/master/assets/themes/speelplekken/shadow.geojson", "geoJson": "https://raw.githubusercontent.com/pietervdvn/MapComplete/master/assets/themes/speelplekken/shadow.geojson",
"osmTags": "shadow=yes", "osmTags": "shadow=yes",

View file

@ -296,8 +296,8 @@ const iconThief = new AggregateIconThief(
const thief = new IdThief("../id-tagging-schema/", iconThief) const thief = new IdThief("../id-tagging-schema/", iconThief)
const shopLayerPath = targetDir + "id_presets.json" const id_presets_path = targetDir + "id_presets.json"
const idPresets = <LayerConfigJson>JSON.parse(readFileSync(shopLayerPath, 'utf8')) const idPresets = <LayerConfigJson>JSON.parse(readFileSync(id_presets_path, 'utf8'))
idPresets.tagRenderings = [ idPresets.tagRenderings = [
{ {
id: "shop_types", id: "shop_types",
@ -309,4 +309,4 @@ idPresets.tagRenderings = [
} }
] ]
writeFileSync(shopLayerPath, JSON.stringify(idPresets, null, " "), 'utf8') writeFileSync(id_presets_path, JSON.stringify(idPresets, null, " "), 'utf8')

View file

@ -54,11 +54,14 @@ function main(){
const wikidataLayer = <LayerConfigJson>{ const wikidataLayer = <LayerConfigJson>{
id: "wikidata", id: "wikidata",
description: "Various tagrenderings which are generated from Wikidata. Automatically generated with a script, don't edit manually", description: {
en: "Various tagrenderings which are generated from Wikidata. Automatically generated with a script, don't edit manually"
},
"#dont-translate": "*", "#dont-translate": "*",
"source": { "source": {
"osmTags": "id~*" "osmTags": "id~*"
}, },
title: null,
"mapRendering": null, "mapRendering": null,
tagRenderings: [ tagRenderings: [
{ {