Improve typing, regen scheme files

This commit is contained in:
pietervdvn 2022-07-18 10:15:51 +02:00
parent a1c4cdd544
commit 8ff405497c
9 changed files with 22772 additions and 318 deletions

View file

@ -106,8 +106,20 @@
"type": "boolean"
},
"isShown": {
"description": "This tag rendering should either be 'yes' or 'no'. If 'no' is returned, then the feature will be hidden from view.\nThis is useful to hide certain features from view.\n\nImportant: hiding features does not work dynamically, but is only calculated when the data is first renders.\nThis implies that it is not possible to hide a feature after a tagging change\n\nThe default value is 'yes'",
"$ref": "#/definitions/TagRenderingConfigJson"
"description": "If set, only features matching this extra tag will be shown.\nThis is useful to hide certain features from view.\n\nImportant: hiding features does not work dynamically, but is only calculated when the data is first renders.\nThis implies that it is not possible to hide a feature after a tagging change\n\nThe default value is 'yes'",
"anyOf": [
{
"$ref": "#/definitions/AndTagConfigJson",
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"$ref": "#/definitions/OrTagConfigJson",
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"type": "string"
}
]
},
"forceLoad": {
"description": "Advanced option - might be set by the theme compiler\n\nIf true, this data will _always_ be loaded, even if the theme is disabled",
@ -303,7 +315,9 @@
}
]
},
"override": {}
"override": {
"$ref": "#/definitions/Partial<QuestionableTagRenderingConfigJson>"
}
},
"required": [
"builtin",
@ -311,7 +325,7 @@
]
},
{
"$ref": "#/definitions/default<(string|QuestionableTagRenderingConfigJson|{builtin:string;override:any;})[]>"
"$ref": "#/definitions/default<(string|QuestionableTagRenderingConfigJson|{builtin:string;override:Partial<QuestionableTagRenderingConfigJson>;})[]>"
},
{
"type": "string"
@ -1027,7 +1041,100 @@
},
"additionalProperties": false
},
"default<(string|QuestionableTagRenderingConfigJson|{builtin:string;override:any;})[]>": {
"Partial<QuestionableTagRenderingConfigJson>": {
"type": "object",
"properties": {
"question": {
"description": "If it turns out that this tagRendering doesn't match _any_ value, then we show this question.\nIf undefined, the question is never asked and this tagrendering is read-only"
},
"freeform": {
"description": "Allow freeform text input from the user",
"type": "object",
"properties": {
"key": {
"type": "string"
},
"type": {
"description": "The type of the text-field, e.g. 'string', 'nat', 'float', 'date',...\nSee Docs/SpecialInputElements.md and UI/Input/ValidatedTextField.ts for supported values",
"type": "string"
},
"placeholder": {
"description": "A (translated) text that is shown (as gray text) within the textfield"
},
"helperArgs": {
"description": "Extra parameters to initialize the input helper arguments.\nFor semantics, see the 'SpecialInputElements.md'",
"type": "array",
"items": {}
},
"addExtraTags": {
"description": "If a value is added with the textfield, these extra tag is addded.\nUseful to add a 'fixme=freeform textfield used - to be checked'",
"type": "array",
"items": {
"type": "string"
}
},
"inline": {
"description": "When set, influences the way a question is asked.\nInstead of showing a full-widht text field, the text field will be shown within the rendering of the question.\n\nThis combines badly with special input elements, as it'll distort the layout.",
"type": "boolean"
},
"default": {
"description": "default value to enter if no previous tagging is present.\nNormally undefined (aka do not enter anything)",
"type": "string"
}
},
"required": [
"key"
]
},
"multiAnswer": {
"description": "If true, use checkboxes instead of radio buttons when asking the question",
"type": "boolean"
},
"mappings": {
"description": "Allows fixed-tag inputs, shown either as radiobuttons or as checkboxes",
"type": "array",
"items": {
"$ref": "#/definitions/MappingConfigJson"
}
},
"id": {
"description": "The id of the tagrendering, should be an unique string.\nUsed to keep the translations in sync. Only used in the tagRenderings-array of a layerConfig, not requered otherwise.\n\nUse 'questions' to trigger the question box of this group (if a group is defined)",
"type": "string"
},
"group": {
"description": "If 'group' is defined on many tagRenderings, these are grouped together when shown. The questions are grouped together as well.\nThe first tagRendering of a group will always be a sticky element.",
"type": "string"
},
"labels": {
"description": "A list of labels. These are strings that are used for various purposes, e.g. to filter them away",
"type": "array",
"items": {
"type": "string"
}
},
"render": {
"description": "Renders this value. Note that \"{key}\"-parts are substituted by the corresponding values of the element.\nIf neither 'textFieldQuestion' nor 'mappings' are defined, this text is simply shown as default value.\n\nNote that this is a HTML-interpreted value, so you can add links as e.g. '<a href='{website}'>{website}</a>' or include images such as `This is of type A <br><img src='typeA-icon.svg' />`\ntype: rendered"
},
"condition": {
"description": "Only show this tagrendering (or ask the question) if the selected object also matches the tags specified as `condition`.\n\nThis is useful to ask a follow-up question.\nFor example, within toilets, asking _where_ the diaper changing table is is only useful _if_ there is one.\nThis can be done by adding `\"condition\": \"changing_table=yes\"`\n\nA full example would be:\n```json\n {\n \"question\": \"Where is the changing table located?\",\n \"render\": \"The changing table is located at {changing_table:location}\",\n \"condition\": \"changing_table=yes\",\n \"freeform\": {\n \"key\": \"changing_table:location\",\n \"inline\": true\n },\n \"mappings\": [\n {\n \"then\": \"The changing table is in the toilet for women.\",\n \"if\": \"changing_table:location=female_toilet\"\n },\n {\n \"then\": \"The changing table is in the toilet for men.\",\n \"if\": \"changing_table:location=male_toilet\"\n },\n {\n \"if\": \"changing_table:location=wheelchair_toilet\",\n \"then\": \"The changing table is in the toilet for wheelchair users.\",\n },\n {\n \"if\": \"changing_table:location=dedicated_room\",\n \"then\": \"The changing table is in a dedicated room. \",\n }\n ],\n \"id\": \"toilet-changing_table:location\"\n },\n```",
"anyOf": [
{
"$ref": "#/definitions/AndTagConfigJson",
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"$ref": "#/definitions/OrTagConfigJson",
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"type": "string"
}
]
}
},
"additionalProperties": false
},
"default<(string|QuestionableTagRenderingConfigJson|{builtin:string;override:Partial<QuestionableTagRenderingConfigJson>;})[]>": {
"description": "Rewrites and multiplies the given renderings of type T.\n\nThis can be used for introducing many similar questions automatically,\nwhich also makes translations easier.\n\n(Note that the key does _not_ need to be wrapped in {}. \nHowever, we recommend to use them if the key is used in a translation, as missing keys will be picked up and warned for by the translation scripts)\n\nFor example:\n\n```\n{\n rewrite: {\n sourceString: [\"key\", \"a|b|c\"],\n into: [\n [\"X\", 0]\n [\"Y\", 1],\n [\"Z\", 2]\n ],\n renderings: [{\n \"key\":\"a|b|c\"\n }]\n }\n}\n```\nwill result in _three_ copies (as the values to rewrite into have three values, namely:\n\n[\n {\n # The first pair: key --> X, a|b|c --> 0\n \"X\": 0\n },\n {\n \"Y\": 1\n },\n {\n \"Z\": 2\n }\n\n]",
"type": "object",
"properties": {
@ -1066,7 +1173,9 @@
"builtin": {
"type": "string"
},
"override": {}
"override": {
"$ref": "#/definitions/Partial<QuestionableTagRenderingConfigJson>"
}
},
"required": [
"builtin",

View file

@ -106,8 +106,20 @@ export default {
"type": "boolean"
},
"isShown": {
"description": "This tag rendering should either be 'yes' or 'no'. If 'no' is returned, then the feature will be hidden from view.\nThis is useful to hide certain features from view.\n\nImportant: hiding features does not work dynamically, but is only calculated when the data is first renders.\nThis implies that it is not possible to hide a feature after a tagging change\n\nThe default value is 'yes'",
"$ref": "#/definitions/TagRenderingConfigJson"
"description": "If set, only features matching this extra tag will be shown.\nThis is useful to hide certain features from view.\n\nImportant: hiding features does not work dynamically, but is only calculated when the data is first renders.\nThis implies that it is not possible to hide a feature after a tagging change\n\nThe default value is 'yes'",
"anyOf": [
{
"$ref": "#/definitions/AndTagConfigJson",
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"$ref": "#/definitions/OrTagConfigJson",
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"type": "string"
}
]
},
"forceLoad": {
"description": "Advanced option - might be set by the theme compiler\n\nIf true, this data will _always_ be loaded, even if the theme is disabled",
@ -303,7 +315,9 @@ export default {
}
]
},
"override": {}
"override": {
"$ref": "#/definitions/Partial<QuestionableTagRenderingConfigJson>"
}
},
"required": [
"builtin",
@ -311,7 +325,7 @@ export default {
]
},
{
"$ref": "#/definitions/default<(string|QuestionableTagRenderingConfigJson|{builtin:string;override:any;})[]>"
"$ref": "#/definitions/default<(string|QuestionableTagRenderingConfigJson|{builtin:string;override:Partial<QuestionableTagRenderingConfigJson>;})[]>"
},
{
"type": "string"
@ -1016,7 +1030,99 @@ export default {
}
}
},
"default<(string|QuestionableTagRenderingConfigJson|{builtin:string;override:any;})[]>": {
"Partial<QuestionableTagRenderingConfigJson>": {
"type": "object",
"properties": {
"question": {
"description": "If it turns out that this tagRendering doesn't match _any_ value, then we show this question.\nIf undefined, the question is never asked and this tagrendering is read-only"
},
"freeform": {
"description": "Allow freeform text input from the user",
"type": "object",
"properties": {
"key": {
"type": "string"
},
"type": {
"description": "The type of the text-field, e.g. 'string', 'nat', 'float', 'date',...\nSee Docs/SpecialInputElements.md and UI/Input/ValidatedTextField.ts for supported values",
"type": "string"
},
"placeholder": {
"description": "A (translated) text that is shown (as gray text) within the textfield"
},
"helperArgs": {
"description": "Extra parameters to initialize the input helper arguments.\nFor semantics, see the 'SpecialInputElements.md'",
"type": "array",
"items": {}
},
"addExtraTags": {
"description": "If a value is added with the textfield, these extra tag is addded.\nUseful to add a 'fixme=freeform textfield used - to be checked'",
"type": "array",
"items": {
"type": "string"
}
},
"inline": {
"description": "When set, influences the way a question is asked.\nInstead of showing a full-widht text field, the text field will be shown within the rendering of the question.\n\nThis combines badly with special input elements, as it'll distort the layout.",
"type": "boolean"
},
"default": {
"description": "default value to enter if no previous tagging is present.\nNormally undefined (aka do not enter anything)",
"type": "string"
}
},
"required": [
"key"
]
},
"multiAnswer": {
"description": "If true, use checkboxes instead of radio buttons when asking the question",
"type": "boolean"
},
"mappings": {
"description": "Allows fixed-tag inputs, shown either as radiobuttons or as checkboxes",
"type": "array",
"items": {
"$ref": "#/definitions/MappingConfigJson"
}
},
"id": {
"description": "The id of the tagrendering, should be an unique string.\nUsed to keep the translations in sync. Only used in the tagRenderings-array of a layerConfig, not requered otherwise.\n\nUse 'questions' to trigger the question box of this group (if a group is defined)",
"type": "string"
},
"group": {
"description": "If 'group' is defined on many tagRenderings, these are grouped together when shown. The questions are grouped together as well.\nThe first tagRendering of a group will always be a sticky element.",
"type": "string"
},
"labels": {
"description": "A list of labels. These are strings that are used for various purposes, e.g. to filter them away",
"type": "array",
"items": {
"type": "string"
}
},
"render": {
"description": "Renders this value. Note that \"{key}\"-parts are substituted by the corresponding values of the element.\nIf neither 'textFieldQuestion' nor 'mappings' are defined, this text is simply shown as default value.\n\nNote that this is a HTML-interpreted value, so you can add links as e.g. '<a href='{website}'>{website}</a>' or include images such as `This is of type A <br><img src='typeA-icon.svg' />`\ntype: rendered"
},
"condition": {
"description": "Only show this tagrendering (or ask the question) if the selected object also matches the tags specified as `condition`.\n\nThis is useful to ask a follow-up question.\nFor example, within toilets, asking _where_ the diaper changing table is is only useful _if_ there is one.\nThis can be done by adding `\"condition\": \"changing_table=yes\"`\n\nA full example would be:\n```json\n {\n \"question\": \"Where is the changing table located?\",\n \"render\": \"The changing table is located at {changing_table:location}\",\n \"condition\": \"changing_table=yes\",\n \"freeform\": {\n \"key\": \"changing_table:location\",\n \"inline\": true\n },\n \"mappings\": [\n {\n \"then\": \"The changing table is in the toilet for women.\",\n \"if\": \"changing_table:location=female_toilet\"\n },\n {\n \"then\": \"The changing table is in the toilet for men.\",\n \"if\": \"changing_table:location=male_toilet\"\n },\n {\n \"if\": \"changing_table:location=wheelchair_toilet\",\n \"then\": \"The changing table is in the toilet for wheelchair users.\",\n },\n {\n \"if\": \"changing_table:location=dedicated_room\",\n \"then\": \"The changing table is in a dedicated room. \",\n }\n ],\n \"id\": \"toilet-changing_table:location\"\n },\n```",
"anyOf": [
{
"$ref": "#/definitions/AndTagConfigJson",
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"$ref": "#/definitions/OrTagConfigJson",
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"type": "string"
}
]
}
}
},
"default<(string|QuestionableTagRenderingConfigJson|{builtin:string;override:Partial<QuestionableTagRenderingConfigJson>;})[]>": {
"description": "Rewrites and multiplies the given renderings of type T.\n\nThis can be used for introducing many similar questions automatically,\nwhich also makes translations easier.\n\n(Note that the key does _not_ need to be wrapped in {}. \nHowever, we recommend to use them if the key is used in a translation, as missing keys will be picked up and warned for by the translation scripts)\n\nFor example:\n\n```\n{\n rewrite: {\n sourceString: [\"key\", \"a|b|c\"],\n into: [\n [\"X\", 0]\n [\"Y\", 1],\n [\"Z\", 2]\n ],\n renderings: [{\n \"key\":\"a|b|c\"\n }]\n }\n}\n```\nwill result in _three_ copies (as the values to rewrite into have three values, namely:\n\n[\n {\n # The first pair: key --> X, a|b|c --> 0\n \"X\": 0\n },\n {\n \"Y\": 1\n },\n {\n \"Z\": 2\n }\n\n]",
"type": "object",
"properties": {
@ -1055,7 +1161,9 @@ export default {
"builtin": {
"type": "string"
},
"override": {}
"override": {
"$ref": "#/definitions/Partial<QuestionableTagRenderingConfigJson>"
}
},
"required": [
"builtin",

View file

@ -68,7 +68,8 @@
"type": "number"
},
"overrideAll": {
"description": "An override applied on all layers of the theme.\n\nE.g.: if there are two layers defined:\n```\n\"layers\":[\n {\"title\": ..., \"tagRenderings\": [...], \"osmSource\":{\"tags\": ...}},\n {\"title\", ..., \"tagRenderings\", [...], \"osmSource\":{\"tags\" ...}}\n]\n```\n\nand overrideAll is specified:\n```\n\"overrideAll\": {\n \"osmSource\":{\"geoJsonSource\":\"xyz\"}\n}\nthen the result will be that all the layers will have these properties applied and result in:\n\"layers\":[\n {\"title\": ..., \"tagRenderings\": [...], \"osmSource\":{\"tags\": ..., \"geoJsonSource\":\"xyz\"}},\n {\"title\", ..., \"tagRenderings\", [...], \"osmSource\":{\"tags\" ..., \"geoJsonSource\":\"xyz\"}}\n]\n```\n\nIf the overrideAll contains a list where the keys starts with a plus, the values will be appended (instead of discarding the old list), for example\n\n\"overrideAll\": {\n \"+tagRenderings\": [ { ... some tagrendering ... }]\n}\n\nIn the above scenario, `sometagrendering` will be added at the beginning of the tagrenderings of every layer"
"description": "An override applied on all layers of the theme.\n\nE.g.: if there are two layers defined:\n```\n\"layers\":[\n {\"title\": ..., \"tagRenderings\": [...], \"osmSource\":{\"tags\": ...}},\n {\"title\", ..., \"tagRenderings\", [...], \"osmSource\":{\"tags\" ...}}\n]\n```\n\nand overrideAll is specified:\n```\n\"overrideAll\": {\n \"osmSource\":{\"geoJsonSource\":\"xyz\"}\n}\nthen the result will be that all the layers will have these properties applied and result in:\n\"layers\":[\n {\"title\": ..., \"tagRenderings\": [...], \"osmSource\":{\"tags\": ..., \"geoJsonSource\":\"xyz\"}},\n {\"title\", ..., \"tagRenderings\", [...], \"osmSource\":{\"tags\" ..., \"geoJsonSource\":\"xyz\"}}\n]\n```\n\nIf the overrideAll contains a list where the keys starts with a plus, the values will be appended (instead of discarding the old list), for example\n\n\"overrideAll\": {\n \"+tagRenderings\": [ { ... some tagrendering ... }]\n}\n\nIn the above scenario, `sometagrendering` will be added at the beginning of the tagrenderings of every layer",
"$ref": "#/definitions/Partial<LayerConfigJson>"
},
"defaultBackgroundId": {
"description": "The id of the default background. BY default: vanilla OSM",
@ -924,7 +925,100 @@
},
"additionalProperties": false
},
"default<(string|QuestionableTagRenderingConfigJson|{builtin:string;override:any;})[]>": {
"Partial<QuestionableTagRenderingConfigJson>": {
"type": "object",
"properties": {
"question": {
"description": "If it turns out that this tagRendering doesn't match _any_ value, then we show this question.\nIf undefined, the question is never asked and this tagrendering is read-only"
},
"freeform": {
"description": "Allow freeform text input from the user",
"type": "object",
"properties": {
"key": {
"type": "string"
},
"type": {
"description": "The type of the text-field, e.g. 'string', 'nat', 'float', 'date',...\nSee Docs/SpecialInputElements.md and UI/Input/ValidatedTextField.ts for supported values",
"type": "string"
},
"placeholder": {
"description": "A (translated) text that is shown (as gray text) within the textfield"
},
"helperArgs": {
"description": "Extra parameters to initialize the input helper arguments.\nFor semantics, see the 'SpecialInputElements.md'",
"type": "array",
"items": {}
},
"addExtraTags": {
"description": "If a value is added with the textfield, these extra tag is addded.\nUseful to add a 'fixme=freeform textfield used - to be checked'",
"type": "array",
"items": {
"type": "string"
}
},
"inline": {
"description": "When set, influences the way a question is asked.\nInstead of showing a full-widht text field, the text field will be shown within the rendering of the question.\n\nThis combines badly with special input elements, as it'll distort the layout.",
"type": "boolean"
},
"default": {
"description": "default value to enter if no previous tagging is present.\nNormally undefined (aka do not enter anything)",
"type": "string"
}
},
"required": [
"key"
]
},
"multiAnswer": {
"description": "If true, use checkboxes instead of radio buttons when asking the question",
"type": "boolean"
},
"mappings": {
"description": "Allows fixed-tag inputs, shown either as radiobuttons or as checkboxes",
"type": "array",
"items": {
"$ref": "#/definitions/MappingConfigJson"
}
},
"id": {
"description": "The id of the tagrendering, should be an unique string.\nUsed to keep the translations in sync. Only used in the tagRenderings-array of a layerConfig, not requered otherwise.\n\nUse 'questions' to trigger the question box of this group (if a group is defined)",
"type": "string"
},
"group": {
"description": "If 'group' is defined on many tagRenderings, these are grouped together when shown. The questions are grouped together as well.\nThe first tagRendering of a group will always be a sticky element.",
"type": "string"
},
"labels": {
"description": "A list of labels. These are strings that are used for various purposes, e.g. to filter them away",
"type": "array",
"items": {
"type": "string"
}
},
"render": {
"description": "Renders this value. Note that \"{key}\"-parts are substituted by the corresponding values of the element.\nIf neither 'textFieldQuestion' nor 'mappings' are defined, this text is simply shown as default value.\n\nNote that this is a HTML-interpreted value, so you can add links as e.g. '<a href='{website}'>{website}</a>' or include images such as `This is of type A <br><img src='typeA-icon.svg' />`\ntype: rendered"
},
"condition": {
"description": "Only show this tagrendering (or ask the question) if the selected object also matches the tags specified as `condition`.\n\nThis is useful to ask a follow-up question.\nFor example, within toilets, asking _where_ the diaper changing table is is only useful _if_ there is one.\nThis can be done by adding `\"condition\": \"changing_table=yes\"`\n\nA full example would be:\n```json\n {\n \"question\": \"Where is the changing table located?\",\n \"render\": \"The changing table is located at {changing_table:location}\",\n \"condition\": \"changing_table=yes\",\n \"freeform\": {\n \"key\": \"changing_table:location\",\n \"inline\": true\n },\n \"mappings\": [\n {\n \"then\": \"The changing table is in the toilet for women.\",\n \"if\": \"changing_table:location=female_toilet\"\n },\n {\n \"then\": \"The changing table is in the toilet for men.\",\n \"if\": \"changing_table:location=male_toilet\"\n },\n {\n \"if\": \"changing_table:location=wheelchair_toilet\",\n \"then\": \"The changing table is in the toilet for wheelchair users.\",\n },\n {\n \"if\": \"changing_table:location=dedicated_room\",\n \"then\": \"The changing table is in a dedicated room. \",\n }\n ],\n \"id\": \"toilet-changing_table:location\"\n },\n```",
"anyOf": [
{
"$ref": "#/definitions/AndTagConfigJson",
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"$ref": "#/definitions/OrTagConfigJson",
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"type": "string"
}
]
}
},
"additionalProperties": false
},
"default<(string|QuestionableTagRenderingConfigJson|{builtin:string;override:Partial<QuestionableTagRenderingConfigJson>;})[]>": {
"description": "Rewrites and multiplies the given renderings of type T.\n\nThis can be used for introducing many similar questions automatically,\nwhich also makes translations easier.\n\n(Note that the key does _not_ need to be wrapped in {}. \nHowever, we recommend to use them if the key is used in a translation, as missing keys will be picked up and warned for by the translation scripts)\n\nFor example:\n\n```\n{\n rewrite: {\n sourceString: [\"key\", \"a|b|c\"],\n into: [\n [\"X\", 0]\n [\"Y\", 1],\n [\"Z\", 2]\n ],\n renderings: [{\n \"key\":\"a|b|c\"\n }]\n }\n}\n```\nwill result in _three_ copies (as the values to rewrite into have three values, namely:\n\n[\n {\n # The first pair: key --> X, a|b|c --> 0\n \"X\": 0\n },\n {\n \"Y\": 1\n },\n {\n \"Z\": 2\n }\n\n]",
"type": "object",
"properties": {
@ -963,7 +1057,9 @@
"builtin": {
"type": "string"
},
"override": {}
"override": {
"$ref": "#/definitions/Partial<QuestionableTagRenderingConfigJson>"
}
},
"required": [
"builtin",
@ -1155,47 +1251,7 @@
],
"additionalProperties": false
},
"default_6": {
"description": "Configuration for a tilesource config",
"type": "object",
"properties": {
"id": {
"description": "Id of this overlay, used in the URL-parameters to set the state",
"type": "string"
},
"source": {
"description": "The path, where {x}, {y} and {z} will be substituted",
"type": "string"
},
"isOverlay": {
"description": "Wether or not this is an overlay. Default: true",
"type": "boolean"
},
"name": {
"description": "How this will be shown in the selection menu.\nMake undefined if this may not be toggled"
},
"minZoom": {
"description": "Only visible at this or a higher zoom level",
"type": "number"
},
"maxZoom": {
"description": "Only visible at this or a lower zoom level",
"type": "number"
},
"defaultState": {
"description": "The default state, set to false to hide by default",
"type": "boolean"
}
},
"required": [
"defaultState",
"id",
"source"
],
"additionalProperties": false
},
"LayerConfigJson": {
"description": "Configuration for a single layer",
"Partial<LayerConfigJson>": {
"type": "object",
"properties": {
"id": {
@ -1302,8 +1358,20 @@
"type": "boolean"
},
"isShown": {
"description": "This tag rendering should either be 'yes' or 'no'. If 'no' is returned, then the feature will be hidden from view.\nThis is useful to hide certain features from view.\n\nImportant: hiding features does not work dynamically, but is only calculated when the data is first renders.\nThis implies that it is not possible to hide a feature after a tagging change\n\nThe default value is 'yes'",
"$ref": "#/definitions/TagRenderingConfigJson"
"description": "If set, only features matching this extra tag will be shown.\nThis is useful to hide certain features from view.\n\nImportant: hiding features does not work dynamically, but is only calculated when the data is first renders.\nThis implies that it is not possible to hide a feature after a tagging change\n\nThe default value is 'yes'",
"anyOf": [
{
"$ref": "#/definitions/AndTagConfigJson",
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"$ref": "#/definitions/OrTagConfigJson",
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"type": "string"
}
]
},
"forceLoad": {
"description": "Advanced option - might be set by the theme compiler\n\nIf true, this data will _always_ be loaded, even if the theme is disabled",
@ -1499,7 +1567,9 @@
}
]
},
"override": {}
"override": {
"$ref": "#/definitions/Partial<QuestionableTagRenderingConfigJson>"
}
},
"required": [
"builtin",
@ -1507,7 +1577,449 @@
]
},
{
"$ref": "#/definitions/default<(string|QuestionableTagRenderingConfigJson|{builtin:string;override:any;})[]>"
"$ref": "#/definitions/default<(string|QuestionableTagRenderingConfigJson|{builtin:string;override:Partial<QuestionableTagRenderingConfigJson>;})[]>"
},
{
"type": "string"
}
]
}
},
"filter": {
"description": "All the extra questions for filtering",
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/definitions/default_1"
}
},
{
"type": "object",
"properties": {
"sameAs": {
"type": "string"
}
},
"required": [
"sameAs"
]
}
]
},
"deletion": {
"description": "This block defines under what circumstances the delete dialog is shown for objects of this layer.\nIf set, a dialog is shown to the user to (soft) delete the point.\nThe dialog is built to be user friendly and to prevent mistakes.\nIf deletion is not possible, the dialog will hide itself and show the reason of non-deletability instead.\n\nTo configure, the following values are possible:\n\n- false: never ever show the delete button\n- true: show the default delete button\n- undefined: use the mapcomplete default to show deletion or not. Currently, this is the same as 'false' but this will change in the future\n- or: a hash with options (see below)\n\n The delete dialog\n =================\n\n\n\n#### Hard deletion if enough experience\n\nA feature can only be deleted from OpenStreetMap by mapcomplete if:\n\n- It is a node\n- No ways or relations use the node\n- The logged-in user has enough experience OR the user is the only one to have edited the point previously\n- The logged-in user has no unread messages (or has a ton of experience)\n- The user did not select one of the 'non-delete-options' (see below)\n\nIn all other cases, a 'soft deletion' is used.\n\n#### Soft deletion\n\nA 'soft deletion' is when the point isn't deleted from OSM but retagged so that it'll won't how up in the mapcomplete theme anymore.\nThis makes it look like it was deleted, without doing damage. A fixme will be added to the point.\n\nNote that a soft deletion is _only_ possible if these tags are provided by the theme creator, as they'll be different for every theme\n\n#### No-delete options\n\nIn some cases, the contributor might want to delete something for the wrong reason (e.g. someone who wants to have a path removed \"because the path is on their private property\").\nHowever, the path exists in reality and should thus be on OSM - otherwise the next contributor will pass by and notice \"hey, there is a path missing here! Let me redraw it in OSM!)\n\nThe correct approach is to retag the feature in such a way that it is semantically correct *and* that it doesn't show up on the theme anymore.\nA no-delete option is offered as 'reason to delete it', but secretly retags.",
"anyOf": [
{
"$ref": "#/definitions/DeleteConfigJson"
},
{
"type": "boolean"
}
]
},
"allowMove": {
"description": "Indicates if a point can be moved and configures the modalities.\n\nA feature can be moved by MapComplete if:\n\n- It is a point\n- The point is _not_ part of a way or a a relation.\n\nOff by default. Can be enabled by setting this flag or by configuring.",
"anyOf": [
{
"$ref": "#/definitions/default_3"
},
{
"type": "boolean"
}
]
},
"allowSplit": {
"description": "If set, a 'split this way' button is shown on objects rendered as LineStrings, e.g. highways.\n\nIf the way is part of a relation, MapComplete will attempt to update this relation as well",
"type": "boolean"
},
"units": {
"description": "In some cases, a value is represented in a certain unit (such as meters for heigt/distance/..., km/h for speed, ...)\n\nSometimes, multiple denominations are possible (e.g. km/h vs mile/h; megawatt vs kilowatt vs gigawatt for power generators, ...)\n\nThis brings in some troubles, as there are multiple ways to write it (no denomitation, 'm' vs 'meter' 'metre', ...)\n\nNot only do we want to write consistent data to OSM, we also want to present this consistently to the user.\nThis is handled by defining units.\n\n# Rendering\n\nTo render a value with long (human) denomination, use {canonical(key)}\n\n# Usage\n\nFirst of all, you define which keys have units applied, for example:\n\n```\nunits: [\n appliesTo: [\"maxspeed\", \"maxspeed:hgv\", \"maxspeed:bus\"]\n applicableUnits: [\n ...\n ]\n]\n```\n\nApplicableUnits defines which is the canonical extension, how it is presented to the user, ...:\n\n```\napplicableUnits: [\n{\n canonicalDenomination: \"km/h\",\n alternativeDenomination: [\"km/u\", \"kmh\", \"kph\"]\n default: true,\n human: {\n en: \"kilometer/hour\",\n nl: \"kilometer/uur\"\n },\n humanShort: {\n en: \"km/h\",\n nl: \"km/u\"\n }\n},\n{\n canoncialDenomination: \"mph\",\n ... similar for miles an hour ...\n}\n]\n```\n\n\nIf this is defined, then every key which the denominations apply to (`maxspeed`, `maxspeed:hgv` and `maxspeed:bus`) will be rewritten at the metatagging stage:\nevery value will be parsed and the canonical extension will be added add presented to the other parts of the code.\n\nAlso, if a freeform text field is used, an extra dropdown with applicable denominations will be given",
"type": "array",
"items": {
"$ref": "#/definitions/default_2"
}
},
"syncSelection": {
"description": "If set, synchronizes whether or not this layer is enabled.\n\nno: Do not sync at all, always revert to default\nlocal: keep selection on local storage\ntheme-only: sync via OSM, but this layer will only be toggled in this theme\nglobal: all layers with this ID will be synced accross all themes",
"enum": [
"global",
"local",
"no",
"theme-only"
],
"type": "string"
}
},
"additionalProperties": false
},
"default_6": {
"description": "Configuration for a tilesource config",
"type": "object",
"properties": {
"id": {
"description": "Id of this overlay, used in the URL-parameters to set the state",
"type": "string"
},
"source": {
"description": "The path, where {x}, {y} and {z} will be substituted",
"type": "string"
},
"isOverlay": {
"description": "Wether or not this is an overlay. Default: true",
"type": "boolean"
},
"name": {
"description": "How this will be shown in the selection menu.\nMake undefined if this may not be toggled"
},
"minZoom": {
"description": "Only visible at this or a higher zoom level",
"type": "number"
},
"maxZoom": {
"description": "Only visible at this or a lower zoom level",
"type": "number"
},
"defaultState": {
"description": "The default state, set to false to hide by default",
"type": "boolean"
}
},
"required": [
"defaultState",
"id",
"source"
],
"additionalProperties": false
},
"LayerConfigJson": {
"description": "Configuration for a single layer",
"type": "object",
"properties": {
"id": {
"description": "The id of this layer.\nThis should be a simple, lowercase, human readable string that is used to identify the layer.",
"type": "string"
},
"name": {
"description": "The name of this layer\nUsed in the layer control panel and the 'Personal theme'.\n\nIf not given, will be hidden (and thus not toggable) in the layer control"
},
"description": {
"description": "A description for this layer.\nShown in the layer selections and in the personel theme"
},
"source": {
"description": "This determines where the data for the layer is fetched: from OSM or from an external geojson dataset.\n\nIf no 'geojson' is defined, data will be fetched from overpass and the OSM-API.\n\nEvery source _must_ define which tags _must_ be present in order to be picked up.",
"anyOf": [
{
"allOf": [
{
"type": "object",
"properties": {
"osmTags": {
"$ref": "#/definitions/TagConfigJson",
"description": "Every source must set which tags have to be present in order to load the given layer."
},
"maxCacheAge": {
"description": "The maximum amount of seconds that a tile is allowed to linger in the cache",
"type": "number"
}
},
"required": [
"osmTags"
]
},
{
"type": "object",
"properties": {
"overpassScript": {
"description": "If set, this custom overpass-script will be used instead of building one by using the OSM-tags.\nSpecifying OSM-tags is still obligatory and will still hide non-matching items and they will be used for the rest of the pipeline.\n_This should be really rare_.\n\nFor example, when you want to fetch all grass-areas in parks and which are marked as publicly accessible: \n```\n\"source\": {\n \"overpassScript\": \n \"way[\\\"leisure\\\"=\\\"park\\\"];node(w);is_in;area._[\\\"leisure\\\"=\\\"park\\\"];(way(area)[\\\"landuse\\\"=\\\"grass\\\"]; node(w); );\",\n \"osmTags\": \"access=yes\"\n}\n```",
"type": "string"
}
}
}
]
},
{
"allOf": [
{
"type": "object",
"properties": {
"osmTags": {
"$ref": "#/definitions/TagConfigJson",
"description": "Every source must set which tags have to be present in order to load the given layer."
},
"maxCacheAge": {
"description": "The maximum amount of seconds that a tile is allowed to linger in the cache",
"type": "number"
}
},
"required": [
"osmTags"
]
},
{
"type": "object",
"properties": {
"geoJson": {
"description": "The actual source of the data to load, if loaded via geojson.\n\n# A single geojson-file\nsource: {geoJson: \"https://my.source.net/some-geo-data.geojson\"}\n fetches a geojson from a third party source\n\n# A tiled geojson source\nsource: {geoJson: \"https://my.source.net/some-tile-geojson-{layer}-{z}-{x}-{y}.geojson\", geoJsonZoomLevel: 14}\n to use a tiled geojson source. The web server must offer multiple geojsons. {z}, {x} and {y} are substituted by the location; {layer} is substituted with the id of the loaded layer\n\nSome API's use a BBOX instead of a tile, this can be used by specifying {y_min}, {y_max}, {x_min} and {x_max}",
"type": "string"
},
"geoJsonZoomLevel": {
"description": "To load a tiled geojson layer, set the zoomlevel of the tiles",
"type": "number"
},
"isOsmCache": {
"description": "Indicates that the upstream geojson data is OSM-derived.\nUseful for e.g. merging or for scripts generating this cache",
"type": "boolean"
},
"mercatorCrs": {
"description": "Some API's use a mercator-projection (EPSG:900913) instead of WGS84. Set the flag `mercatorCrs: true` in the source for this",
"type": "boolean"
},
"idKey": {
"description": "Some API's have an id-field, but give it a different name.\nSetting this key will rename this field into 'id'",
"type": "string"
}
},
"required": [
"geoJson"
]
}
]
}
]
},
"calculatedTags": {
"description": "A list of extra tags to calculate, specified as \"keyToAssignTo=javascript-expression\".\nThere are a few extra functions available. Refer to <a>Docs/CalculatedTags.md</a> for more information\nThe functions will be run in order, e.g.\n[\n \"_max_overlap_m2=Math.max(...feat.overlapsWith(\"someOtherLayer\").map(o => o.overlap))\n \"_max_overlap_ratio=Number(feat._max_overlap_m2)/feat.area\n]\n\nThe specified tags are evaluated lazily. E.g. if a calculated tag is only used in the popup (e.g. the number of nearby features),\nthe expensive calculation will only be performed then for that feature. This avoids clogging up the contributors PC when all features are loaded.\n\nIf a tag has to be evaluated strictly, use ':=' instead:\n\n[\n\"_some_key:=some_javascript_expression\"\n]",
"type": "array",
"items": {
"type": "string"
}
},
"doNotDownload": {
"description": "If set, this layer will not query overpass; but it'll still match the tags above which are by chance returned by other layers.\nWorks well together with 'passAllFeatures', to add decoration",
"type": "boolean"
},
"isShown": {
"description": "If set, only features matching this extra tag will be shown.\nThis is useful to hide certain features from view.\n\nImportant: hiding features does not work dynamically, but is only calculated when the data is first renders.\nThis implies that it is not possible to hide a feature after a tagging change\n\nThe default value is 'yes'",
"anyOf": [
{
"$ref": "#/definitions/AndTagConfigJson",
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"$ref": "#/definitions/OrTagConfigJson",
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"type": "string"
}
]
},
"forceLoad": {
"description": "Advanced option - might be set by the theme compiler\n\nIf true, this data will _always_ be loaded, even if the theme is disabled",
"type": "boolean"
},
"minzoom": {
"description": "The minimum needed zoomlevel required before loading of the data start\nDefault: 0",
"type": "number"
},
"shownByDefault": {
"description": "Indicates if this layer is shown by default;\ncan be used to hide a layer from start, or to load the layer but only to show it where appropriate (e.g. for snapping to it)",
"type": "boolean"
},
"minzoomVisible": {
"description": "The zoom level at which point the data is hidden again\nDefault: 100 (thus: always visible",
"type": "number"
},
"title": {
"description": "The title shown in a popup for elements of this layer.",
"anyOf": [
{
"$ref": "#/definitions/TagRenderingConfigJson"
},
{
"type": "string"
}
]
},
"titleIcons": {
"description": "Small icons shown next to the title.\nIf not specified, the OsmLink and wikipedia links will be used by default.\nUse an empty array to hide them.\nNote that \"defaults\" will insert all the default titleIcons (which are added automatically)\n\nType: icon[]",
"anyOf": [
{
"type": "array",
"items": {
"anyOf": [
{
"$ref": "#/definitions/TagRenderingConfigJson"
},
{
"type": "string"
}
]
}
},
{
"type": "array",
"items": [
{
"type": "string",
"enum": [
"defaults"
]
}
],
"minItems": 1,
"maxItems": 1
}
]
},
"mapRendering": {
"description": "Visualisation of the items on the map",
"anyOf": [
{
"type": "array",
"items": {
"anyOf": [
{
"$ref": "#/definitions/default_4"
},
{
"$ref": "#/definitions/default_5"
},
{
"$ref": "#/definitions/default<default|default|default[]|default[]>"
}
]
}
},
{
"type": "null"
}
]
},
"passAllFeatures": {
"description": "If set, this layer will pass all the features it receives onto the next layer.\nThis is ideal for decoration, e.g. directionss on cameras",
"type": "boolean"
},
"presets": {
"description": "Presets for this layer.\nA preset shows up when clicking the map on a without data (or when right-clicking/long-pressing);\nit will prompt the user to add a new point.\n\nThe most important aspect are the tags, which define which tags the new point will have;\nThe title is shown in the dialog, along with the first sentence of the description.\n\nUpon confirmation, the full description is shown beneath the buttons - perfect to add pictures and examples.\n\nNote: the icon of the preset is determined automatically based on the tags and the icon above. Don't worry about that!\nNB: if no presets are defined, the popup to add new points doesn't show up at all",
"type": "array",
"items": {
"type": "object",
"properties": {
"title": {
"description": "The title - shown on the 'add-new'-button.\n\nThis should include the article of the noun, e.g. 'a hydrant', 'a bicycle pump'.\nThis text will be inserted into `Add {category} here`, becoming `Add a hydrant here`.\n\nDo _not_ indicate 'new': 'add a new shop here' is incorrect, as the shop might have existed forever, it could just be unmapped!"
},
"tags": {
"description": "The tags to add. It determines the icon too",
"type": "array",
"items": {
"type": "string"
}
},
"description": {
"description": "The _first sentence_ of the description is shown on the button of the `add` menu.\nThe full description is shown in the confirmation dialog.\n\n(The first sentence is until the first '.'-character in the description)"
},
"exampleImages": {
"description": "Example images, which show real-life pictures of what such a feature might look like\n\nType: image",
"type": "array",
"items": {
"type": "string"
}
},
"preciseInput": {
"description": "If set, the user will prompted to confirm the location before actually adding the data.\nThis will be with a 'drag crosshair'-method.\n\nIf 'preferredBackgroundCategory' is set, the element will attempt to pick a background layer of that category.",
"anyOf": [
{
"type": "object",
"properties": {
"preferredBackground": {
"description": "The type of background picture",
"anyOf": [
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "string"
}
]
},
"snapToLayer": {
"description": "If specified, these layers will be shown to and the new point will be snapped towards it",
"anyOf": [
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "string"
}
]
},
"maxSnapDistance": {
"description": "If specified, a new point will only be snapped if it is within this range.\nDistance in meter\n\nDefault: 10",
"type": "number"
}
},
"required": [
"preferredBackground"
]
},
{
"enum": [
true
],
"type": "boolean"
}
]
}
},
"required": [
"tags",
"title"
]
}
},
"tagRenderings": {
"description": "All the tag renderings.\nA tag rendering is a block that either shows the known value or asks a question.\n\nRefer to the class `TagRenderingConfigJson` to see the possibilities.\n\nNote that we can also use a string here - where the string refers to a tag rendering defined in `assets/questions/questions.json`,\nwhere a few very general questions are defined e.g. website, phone number, ...\nFurthermore, _all_ the questions of another layer can be reused with `otherlayer.*`\nIf you need only a single of the tagRenderings, use `otherlayer.tagrenderingId`\nIf one or more questions have a 'group' or 'label' set, select all the entries with the corresponding group or label with `otherlayer.*group`\nRemark: if a tagRendering is 'lent' from another layer, the 'source'-tags are copied and added as condition.\nIf they are not wanted, remove them with an override\n\nA special value is 'questions', which indicates the location of the questions box. If not specified, it'll be appended to the bottom of the featureInfobox.\n\nAt last, one can define a group of renderings where parts of all strings will be replaced by multiple other strings.\nThis is mainly create questions for a 'left' and a 'right' side of the road.\nThese will be grouped and questions will be asked together",
"type": "array",
"items": {
"anyOf": [
{
"$ref": "#/definitions/QuestionableTagRenderingConfigJson"
},
{
"type": "object",
"properties": {
"builtin": {
"anyOf": [
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "string"
}
]
},
"override": {
"$ref": "#/definitions/Partial<QuestionableTagRenderingConfigJson>"
}
},
"required": [
"builtin",
"override"
]
},
{
"$ref": "#/definitions/default<(string|QuestionableTagRenderingConfigJson|{builtin:string;override:Partial<QuestionableTagRenderingConfigJson>;})[]>"
},
{
"type": "string"

View file

@ -68,7 +68,8 @@ export default {
"type": "number"
},
"overrideAll": {
"description": "An override applied on all layers of the theme.\n\nE.g.: if there are two layers defined:\n```\n\"layers\":[\n {\"title\": ..., \"tagRenderings\": [...], \"osmSource\":{\"tags\": ...}},\n {\"title\", ..., \"tagRenderings\", [...], \"osmSource\":{\"tags\" ...}}\n]\n```\n\nand overrideAll is specified:\n```\n\"overrideAll\": {\n \"osmSource\":{\"geoJsonSource\":\"xyz\"}\n}\nthen the result will be that all the layers will have these properties applied and result in:\n\"layers\":[\n {\"title\": ..., \"tagRenderings\": [...], \"osmSource\":{\"tags\": ..., \"geoJsonSource\":\"xyz\"}},\n {\"title\", ..., \"tagRenderings\", [...], \"osmSource\":{\"tags\" ..., \"geoJsonSource\":\"xyz\"}}\n]\n```\n\nIf the overrideAll contains a list where the keys starts with a plus, the values will be appended (instead of discarding the old list), for example\n\n\"overrideAll\": {\n \"+tagRenderings\": [ { ... some tagrendering ... }]\n}\n\nIn the above scenario, `sometagrendering` will be added at the beginning of the tagrenderings of every layer"
"description": "An override applied on all layers of the theme.\n\nE.g.: if there are two layers defined:\n```\n\"layers\":[\n {\"title\": ..., \"tagRenderings\": [...], \"osmSource\":{\"tags\": ...}},\n {\"title\", ..., \"tagRenderings\", [...], \"osmSource\":{\"tags\" ...}}\n]\n```\n\nand overrideAll is specified:\n```\n\"overrideAll\": {\n \"osmSource\":{\"geoJsonSource\":\"xyz\"}\n}\nthen the result will be that all the layers will have these properties applied and result in:\n\"layers\":[\n {\"title\": ..., \"tagRenderings\": [...], \"osmSource\":{\"tags\": ..., \"geoJsonSource\":\"xyz\"}},\n {\"title\", ..., \"tagRenderings\", [...], \"osmSource\":{\"tags\" ..., \"geoJsonSource\":\"xyz\"}}\n]\n```\n\nIf the overrideAll contains a list where the keys starts with a plus, the values will be appended (instead of discarding the old list), for example\n\n\"overrideAll\": {\n \"+tagRenderings\": [ { ... some tagrendering ... }]\n}\n\nIn the above scenario, `sometagrendering` will be added at the beginning of the tagrenderings of every layer",
"$ref": "#/definitions/Partial<LayerConfigJson>"
},
"defaultBackgroundId": {
"description": "The id of the default background. BY default: vanilla OSM",
@ -913,7 +914,99 @@ export default {
}
}
},
"default<(string|QuestionableTagRenderingConfigJson|{builtin:string;override:any;})[]>": {
"Partial<QuestionableTagRenderingConfigJson>": {
"type": "object",
"properties": {
"question": {
"description": "If it turns out that this tagRendering doesn't match _any_ value, then we show this question.\nIf undefined, the question is never asked and this tagrendering is read-only"
},
"freeform": {
"description": "Allow freeform text input from the user",
"type": "object",
"properties": {
"key": {
"type": "string"
},
"type": {
"description": "The type of the text-field, e.g. 'string', 'nat', 'float', 'date',...\nSee Docs/SpecialInputElements.md and UI/Input/ValidatedTextField.ts for supported values",
"type": "string"
},
"placeholder": {
"description": "A (translated) text that is shown (as gray text) within the textfield"
},
"helperArgs": {
"description": "Extra parameters to initialize the input helper arguments.\nFor semantics, see the 'SpecialInputElements.md'",
"type": "array",
"items": {}
},
"addExtraTags": {
"description": "If a value is added with the textfield, these extra tag is addded.\nUseful to add a 'fixme=freeform textfield used - to be checked'",
"type": "array",
"items": {
"type": "string"
}
},
"inline": {
"description": "When set, influences the way a question is asked.\nInstead of showing a full-widht text field, the text field will be shown within the rendering of the question.\n\nThis combines badly with special input elements, as it'll distort the layout.",
"type": "boolean"
},
"default": {
"description": "default value to enter if no previous tagging is present.\nNormally undefined (aka do not enter anything)",
"type": "string"
}
},
"required": [
"key"
]
},
"multiAnswer": {
"description": "If true, use checkboxes instead of radio buttons when asking the question",
"type": "boolean"
},
"mappings": {
"description": "Allows fixed-tag inputs, shown either as radiobuttons or as checkboxes",
"type": "array",
"items": {
"$ref": "#/definitions/MappingConfigJson"
}
},
"id": {
"description": "The id of the tagrendering, should be an unique string.\nUsed to keep the translations in sync. Only used in the tagRenderings-array of a layerConfig, not requered otherwise.\n\nUse 'questions' to trigger the question box of this group (if a group is defined)",
"type": "string"
},
"group": {
"description": "If 'group' is defined on many tagRenderings, these are grouped together when shown. The questions are grouped together as well.\nThe first tagRendering of a group will always be a sticky element.",
"type": "string"
},
"labels": {
"description": "A list of labels. These are strings that are used for various purposes, e.g. to filter them away",
"type": "array",
"items": {
"type": "string"
}
},
"render": {
"description": "Renders this value. Note that \"{key}\"-parts are substituted by the corresponding values of the element.\nIf neither 'textFieldQuestion' nor 'mappings' are defined, this text is simply shown as default value.\n\nNote that this is a HTML-interpreted value, so you can add links as e.g. '<a href='{website}'>{website}</a>' or include images such as `This is of type A <br><img src='typeA-icon.svg' />`\ntype: rendered"
},
"condition": {
"description": "Only show this tagrendering (or ask the question) if the selected object also matches the tags specified as `condition`.\n\nThis is useful to ask a follow-up question.\nFor example, within toilets, asking _where_ the diaper changing table is is only useful _if_ there is one.\nThis can be done by adding `\"condition\": \"changing_table=yes\"`\n\nA full example would be:\n```json\n {\n \"question\": \"Where is the changing table located?\",\n \"render\": \"The changing table is located at {changing_table:location}\",\n \"condition\": \"changing_table=yes\",\n \"freeform\": {\n \"key\": \"changing_table:location\",\n \"inline\": true\n },\n \"mappings\": [\n {\n \"then\": \"The changing table is in the toilet for women.\",\n \"if\": \"changing_table:location=female_toilet\"\n },\n {\n \"then\": \"The changing table is in the toilet for men.\",\n \"if\": \"changing_table:location=male_toilet\"\n },\n {\n \"if\": \"changing_table:location=wheelchair_toilet\",\n \"then\": \"The changing table is in the toilet for wheelchair users.\",\n },\n {\n \"if\": \"changing_table:location=dedicated_room\",\n \"then\": \"The changing table is in a dedicated room. \",\n }\n ],\n \"id\": \"toilet-changing_table:location\"\n },\n```",
"anyOf": [
{
"$ref": "#/definitions/AndTagConfigJson",
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"$ref": "#/definitions/OrTagConfigJson",
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"type": "string"
}
]
}
}
},
"default<(string|QuestionableTagRenderingConfigJson|{builtin:string;override:Partial<QuestionableTagRenderingConfigJson>;})[]>": {
"description": "Rewrites and multiplies the given renderings of type T.\n\nThis can be used for introducing many similar questions automatically,\nwhich also makes translations easier.\n\n(Note that the key does _not_ need to be wrapped in {}. \nHowever, we recommend to use them if the key is used in a translation, as missing keys will be picked up and warned for by the translation scripts)\n\nFor example:\n\n```\n{\n rewrite: {\n sourceString: [\"key\", \"a|b|c\"],\n into: [\n [\"X\", 0]\n [\"Y\", 1],\n [\"Z\", 2]\n ],\n renderings: [{\n \"key\":\"a|b|c\"\n }]\n }\n}\n```\nwill result in _three_ copies (as the values to rewrite into have three values, namely:\n\n[\n {\n # The first pair: key --> X, a|b|c --> 0\n \"X\": 0\n },\n {\n \"Y\": 1\n },\n {\n \"Z\": 2\n }\n\n]",
"type": "object",
"properties": {
@ -952,7 +1045,9 @@ export default {
"builtin": {
"type": "string"
},
"override": {}
"override": {
"$ref": "#/definitions/Partial<QuestionableTagRenderingConfigJson>"
}
},
"required": [
"builtin",
@ -1139,46 +1234,7 @@ export default {
"appliesToKey"
]
},
"default_6": {
"description": "Configuration for a tilesource config",
"type": "object",
"properties": {
"id": {
"description": "Id of this overlay, used in the URL-parameters to set the state",
"type": "string"
},
"source": {
"description": "The path, where {x}, {y} and {z} will be substituted",
"type": "string"
},
"isOverlay": {
"description": "Wether or not this is an overlay. Default: true",
"type": "boolean"
},
"name": {
"description": "How this will be shown in the selection menu.\nMake undefined if this may not be toggled"
},
"minZoom": {
"description": "Only visible at this or a higher zoom level",
"type": "number"
},
"maxZoom": {
"description": "Only visible at this or a lower zoom level",
"type": "number"
},
"defaultState": {
"description": "The default state, set to false to hide by default",
"type": "boolean"
}
},
"required": [
"defaultState",
"id",
"source"
]
},
"LayerConfigJson": {
"description": "Configuration for a single layer",
"Partial<LayerConfigJson>": {
"type": "object",
"properties": {
"id": {
@ -1285,8 +1341,20 @@ export default {
"type": "boolean"
},
"isShown": {
"description": "This tag rendering should either be 'yes' or 'no'. If 'no' is returned, then the feature will be hidden from view.\nThis is useful to hide certain features from view.\n\nImportant: hiding features does not work dynamically, but is only calculated when the data is first renders.\nThis implies that it is not possible to hide a feature after a tagging change\n\nThe default value is 'yes'",
"$ref": "#/definitions/TagRenderingConfigJson"
"description": "If set, only features matching this extra tag will be shown.\nThis is useful to hide certain features from view.\n\nImportant: hiding features does not work dynamically, but is only calculated when the data is first renders.\nThis implies that it is not possible to hide a feature after a tagging change\n\nThe default value is 'yes'",
"anyOf": [
{
"$ref": "#/definitions/AndTagConfigJson",
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"$ref": "#/definitions/OrTagConfigJson",
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"type": "string"
}
]
},
"forceLoad": {
"description": "Advanced option - might be set by the theme compiler\n\nIf true, this data will _always_ be loaded, even if the theme is disabled",
@ -1482,7 +1550,9 @@ export default {
}
]
},
"override": {}
"override": {
"$ref": "#/definitions/Partial<QuestionableTagRenderingConfigJson>"
}
},
"required": [
"builtin",
@ -1490,7 +1560,447 @@ export default {
]
},
{
"$ref": "#/definitions/default<(string|QuestionableTagRenderingConfigJson|{builtin:string;override:any;})[]>"
"$ref": "#/definitions/default<(string|QuestionableTagRenderingConfigJson|{builtin:string;override:Partial<QuestionableTagRenderingConfigJson>;})[]>"
},
{
"type": "string"
}
]
}
},
"filter": {
"description": "All the extra questions for filtering",
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/definitions/default_1"
}
},
{
"type": "object",
"properties": {
"sameAs": {
"type": "string"
}
},
"required": [
"sameAs"
]
}
]
},
"deletion": {
"description": "This block defines under what circumstances the delete dialog is shown for objects of this layer.\nIf set, a dialog is shown to the user to (soft) delete the point.\nThe dialog is built to be user friendly and to prevent mistakes.\nIf deletion is not possible, the dialog will hide itself and show the reason of non-deletability instead.\n\nTo configure, the following values are possible:\n\n- false: never ever show the delete button\n- true: show the default delete button\n- undefined: use the mapcomplete default to show deletion or not. Currently, this is the same as 'false' but this will change in the future\n- or: a hash with options (see below)\n\n The delete dialog\n =================\n\n\n\n#### Hard deletion if enough experience\n\nA feature can only be deleted from OpenStreetMap by mapcomplete if:\n\n- It is a node\n- No ways or relations use the node\n- The logged-in user has enough experience OR the user is the only one to have edited the point previously\n- The logged-in user has no unread messages (or has a ton of experience)\n- The user did not select one of the 'non-delete-options' (see below)\n\nIn all other cases, a 'soft deletion' is used.\n\n#### Soft deletion\n\nA 'soft deletion' is when the point isn't deleted from OSM but retagged so that it'll won't how up in the mapcomplete theme anymore.\nThis makes it look like it was deleted, without doing damage. A fixme will be added to the point.\n\nNote that a soft deletion is _only_ possible if these tags are provided by the theme creator, as they'll be different for every theme\n\n#### No-delete options\n\nIn some cases, the contributor might want to delete something for the wrong reason (e.g. someone who wants to have a path removed \"because the path is on their private property\").\nHowever, the path exists in reality and should thus be on OSM - otherwise the next contributor will pass by and notice \"hey, there is a path missing here! Let me redraw it in OSM!)\n\nThe correct approach is to retag the feature in such a way that it is semantically correct *and* that it doesn't show up on the theme anymore.\nA no-delete option is offered as 'reason to delete it', but secretly retags.",
"anyOf": [
{
"$ref": "#/definitions/DeleteConfigJson"
},
{
"type": "boolean"
}
]
},
"allowMove": {
"description": "Indicates if a point can be moved and configures the modalities.\n\nA feature can be moved by MapComplete if:\n\n- It is a point\n- The point is _not_ part of a way or a a relation.\n\nOff by default. Can be enabled by setting this flag or by configuring.",
"anyOf": [
{
"$ref": "#/definitions/default_3"
},
{
"type": "boolean"
}
]
},
"allowSplit": {
"description": "If set, a 'split this way' button is shown on objects rendered as LineStrings, e.g. highways.\n\nIf the way is part of a relation, MapComplete will attempt to update this relation as well",
"type": "boolean"
},
"units": {
"description": "In some cases, a value is represented in a certain unit (such as meters for heigt/distance/..., km/h for speed, ...)\n\nSometimes, multiple denominations are possible (e.g. km/h vs mile/h; megawatt vs kilowatt vs gigawatt for power generators, ...)\n\nThis brings in some troubles, as there are multiple ways to write it (no denomitation, 'm' vs 'meter' 'metre', ...)\n\nNot only do we want to write consistent data to OSM, we also want to present this consistently to the user.\nThis is handled by defining units.\n\n# Rendering\n\nTo render a value with long (human) denomination, use {canonical(key)}\n\n# Usage\n\nFirst of all, you define which keys have units applied, for example:\n\n```\nunits: [\n appliesTo: [\"maxspeed\", \"maxspeed:hgv\", \"maxspeed:bus\"]\n applicableUnits: [\n ...\n ]\n]\n```\n\nApplicableUnits defines which is the canonical extension, how it is presented to the user, ...:\n\n```\napplicableUnits: [\n{\n canonicalDenomination: \"km/h\",\n alternativeDenomination: [\"km/u\", \"kmh\", \"kph\"]\n default: true,\n human: {\n en: \"kilometer/hour\",\n nl: \"kilometer/uur\"\n },\n humanShort: {\n en: \"km/h\",\n nl: \"km/u\"\n }\n},\n{\n canoncialDenomination: \"mph\",\n ... similar for miles an hour ...\n}\n]\n```\n\n\nIf this is defined, then every key which the denominations apply to (`maxspeed`, `maxspeed:hgv` and `maxspeed:bus`) will be rewritten at the metatagging stage:\nevery value will be parsed and the canonical extension will be added add presented to the other parts of the code.\n\nAlso, if a freeform text field is used, an extra dropdown with applicable denominations will be given",
"type": "array",
"items": {
"$ref": "#/definitions/default_2"
}
},
"syncSelection": {
"description": "If set, synchronizes whether or not this layer is enabled.\n\nno: Do not sync at all, always revert to default\nlocal: keep selection on local storage\ntheme-only: sync via OSM, but this layer will only be toggled in this theme\nglobal: all layers with this ID will be synced accross all themes",
"enum": [
"global",
"local",
"no",
"theme-only"
],
"type": "string"
}
}
},
"default_6": {
"description": "Configuration for a tilesource config",
"type": "object",
"properties": {
"id": {
"description": "Id of this overlay, used in the URL-parameters to set the state",
"type": "string"
},
"source": {
"description": "The path, where {x}, {y} and {z} will be substituted",
"type": "string"
},
"isOverlay": {
"description": "Wether or not this is an overlay. Default: true",
"type": "boolean"
},
"name": {
"description": "How this will be shown in the selection menu.\nMake undefined if this may not be toggled"
},
"minZoom": {
"description": "Only visible at this or a higher zoom level",
"type": "number"
},
"maxZoom": {
"description": "Only visible at this or a lower zoom level",
"type": "number"
},
"defaultState": {
"description": "The default state, set to false to hide by default",
"type": "boolean"
}
},
"required": [
"defaultState",
"id",
"source"
]
},
"LayerConfigJson": {
"description": "Configuration for a single layer",
"type": "object",
"properties": {
"id": {
"description": "The id of this layer.\nThis should be a simple, lowercase, human readable string that is used to identify the layer.",
"type": "string"
},
"name": {
"description": "The name of this layer\nUsed in the layer control panel and the 'Personal theme'.\n\nIf not given, will be hidden (and thus not toggable) in the layer control"
},
"description": {
"description": "A description for this layer.\nShown in the layer selections and in the personel theme"
},
"source": {
"description": "This determines where the data for the layer is fetched: from OSM or from an external geojson dataset.\n\nIf no 'geojson' is defined, data will be fetched from overpass and the OSM-API.\n\nEvery source _must_ define which tags _must_ be present in order to be picked up.",
"anyOf": [
{
"allOf": [
{
"type": "object",
"properties": {
"osmTags": {
"$ref": "#/definitions/TagConfigJson",
"description": "Every source must set which tags have to be present in order to load the given layer."
},
"maxCacheAge": {
"description": "The maximum amount of seconds that a tile is allowed to linger in the cache",
"type": "number"
}
},
"required": [
"osmTags"
]
},
{
"type": "object",
"properties": {
"overpassScript": {
"description": "If set, this custom overpass-script will be used instead of building one by using the OSM-tags.\nSpecifying OSM-tags is still obligatory and will still hide non-matching items and they will be used for the rest of the pipeline.\n_This should be really rare_.\n\nFor example, when you want to fetch all grass-areas in parks and which are marked as publicly accessible: \n```\n\"source\": {\n \"overpassScript\": \n \"way[\\\"leisure\\\"=\\\"park\\\"];node(w);is_in;area._[\\\"leisure\\\"=\\\"park\\\"];(way(area)[\\\"landuse\\\"=\\\"grass\\\"]; node(w); );\",\n \"osmTags\": \"access=yes\"\n}\n```",
"type": "string"
}
}
}
]
},
{
"allOf": [
{
"type": "object",
"properties": {
"osmTags": {
"$ref": "#/definitions/TagConfigJson",
"description": "Every source must set which tags have to be present in order to load the given layer."
},
"maxCacheAge": {
"description": "The maximum amount of seconds that a tile is allowed to linger in the cache",
"type": "number"
}
},
"required": [
"osmTags"
]
},
{
"type": "object",
"properties": {
"geoJson": {
"description": "The actual source of the data to load, if loaded via geojson.\n\n# A single geojson-file\nsource: {geoJson: \"https://my.source.net/some-geo-data.geojson\"}\n fetches a geojson from a third party source\n\n# A tiled geojson source\nsource: {geoJson: \"https://my.source.net/some-tile-geojson-{layer}-{z}-{x}-{y}.geojson\", geoJsonZoomLevel: 14}\n to use a tiled geojson source. The web server must offer multiple geojsons. {z}, {x} and {y} are substituted by the location; {layer} is substituted with the id of the loaded layer\n\nSome API's use a BBOX instead of a tile, this can be used by specifying {y_min}, {y_max}, {x_min} and {x_max}",
"type": "string"
},
"geoJsonZoomLevel": {
"description": "To load a tiled geojson layer, set the zoomlevel of the tiles",
"type": "number"
},
"isOsmCache": {
"description": "Indicates that the upstream geojson data is OSM-derived.\nUseful for e.g. merging or for scripts generating this cache",
"type": "boolean"
},
"mercatorCrs": {
"description": "Some API's use a mercator-projection (EPSG:900913) instead of WGS84. Set the flag `mercatorCrs: true` in the source for this",
"type": "boolean"
},
"idKey": {
"description": "Some API's have an id-field, but give it a different name.\nSetting this key will rename this field into 'id'",
"type": "string"
}
},
"required": [
"geoJson"
]
}
]
}
]
},
"calculatedTags": {
"description": "A list of extra tags to calculate, specified as \"keyToAssignTo=javascript-expression\".\nThere are a few extra functions available. Refer to <a>Docs/CalculatedTags.md</a> for more information\nThe functions will be run in order, e.g.\n[\n \"_max_overlap_m2=Math.max(...feat.overlapsWith(\"someOtherLayer\").map(o => o.overlap))\n \"_max_overlap_ratio=Number(feat._max_overlap_m2)/feat.area\n]\n\nThe specified tags are evaluated lazily. E.g. if a calculated tag is only used in the popup (e.g. the number of nearby features),\nthe expensive calculation will only be performed then for that feature. This avoids clogging up the contributors PC when all features are loaded.\n\nIf a tag has to be evaluated strictly, use ':=' instead:\n\n[\n\"_some_key:=some_javascript_expression\"\n]",
"type": "array",
"items": {
"type": "string"
}
},
"doNotDownload": {
"description": "If set, this layer will not query overpass; but it'll still match the tags above which are by chance returned by other layers.\nWorks well together with 'passAllFeatures', to add decoration",
"type": "boolean"
},
"isShown": {
"description": "If set, only features matching this extra tag will be shown.\nThis is useful to hide certain features from view.\n\nImportant: hiding features does not work dynamically, but is only calculated when the data is first renders.\nThis implies that it is not possible to hide a feature after a tagging change\n\nThe default value is 'yes'",
"anyOf": [
{
"$ref": "#/definitions/AndTagConfigJson",
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"$ref": "#/definitions/OrTagConfigJson",
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"type": "string"
}
]
},
"forceLoad": {
"description": "Advanced option - might be set by the theme compiler\n\nIf true, this data will _always_ be loaded, even if the theme is disabled",
"type": "boolean"
},
"minzoom": {
"description": "The minimum needed zoomlevel required before loading of the data start\nDefault: 0",
"type": "number"
},
"shownByDefault": {
"description": "Indicates if this layer is shown by default;\ncan be used to hide a layer from start, or to load the layer but only to show it where appropriate (e.g. for snapping to it)",
"type": "boolean"
},
"minzoomVisible": {
"description": "The zoom level at which point the data is hidden again\nDefault: 100 (thus: always visible",
"type": "number"
},
"title": {
"description": "The title shown in a popup for elements of this layer.",
"anyOf": [
{
"$ref": "#/definitions/TagRenderingConfigJson"
},
{
"type": "string"
}
]
},
"titleIcons": {
"description": "Small icons shown next to the title.\nIf not specified, the OsmLink and wikipedia links will be used by default.\nUse an empty array to hide them.\nNote that \"defaults\" will insert all the default titleIcons (which are added automatically)\n\nType: icon[]",
"anyOf": [
{
"type": "array",
"items": {
"anyOf": [
{
"$ref": "#/definitions/TagRenderingConfigJson"
},
{
"type": "string"
}
]
}
},
{
"type": "array",
"items": [
{
"type": "string",
"enum": [
"defaults"
]
}
],
"minItems": 1,
"maxItems": 1
}
]
},
"mapRendering": {
"description": "Visualisation of the items on the map",
"anyOf": [
{
"type": "array",
"items": {
"anyOf": [
{
"$ref": "#/definitions/default_4"
},
{
"$ref": "#/definitions/default_5"
},
{
"$ref": "#/definitions/default<default|default|default[]|default[]>"
}
]
}
},
{
"type": "null"
}
]
},
"passAllFeatures": {
"description": "If set, this layer will pass all the features it receives onto the next layer.\nThis is ideal for decoration, e.g. directionss on cameras",
"type": "boolean"
},
"presets": {
"description": "Presets for this layer.\nA preset shows up when clicking the map on a without data (or when right-clicking/long-pressing);\nit will prompt the user to add a new point.\n\nThe most important aspect are the tags, which define which tags the new point will have;\nThe title is shown in the dialog, along with the first sentence of the description.\n\nUpon confirmation, the full description is shown beneath the buttons - perfect to add pictures and examples.\n\nNote: the icon of the preset is determined automatically based on the tags and the icon above. Don't worry about that!\nNB: if no presets are defined, the popup to add new points doesn't show up at all",
"type": "array",
"items": {
"type": "object",
"properties": {
"title": {
"description": "The title - shown on the 'add-new'-button.\n\nThis should include the article of the noun, e.g. 'a hydrant', 'a bicycle pump'.\nThis text will be inserted into `Add {category} here`, becoming `Add a hydrant here`.\n\nDo _not_ indicate 'new': 'add a new shop here' is incorrect, as the shop might have existed forever, it could just be unmapped!"
},
"tags": {
"description": "The tags to add. It determines the icon too",
"type": "array",
"items": {
"type": "string"
}
},
"description": {
"description": "The _first sentence_ of the description is shown on the button of the `add` menu.\nThe full description is shown in the confirmation dialog.\n\n(The first sentence is until the first '.'-character in the description)"
},
"exampleImages": {
"description": "Example images, which show real-life pictures of what such a feature might look like\n\nType: image",
"type": "array",
"items": {
"type": "string"
}
},
"preciseInput": {
"description": "If set, the user will prompted to confirm the location before actually adding the data.\nThis will be with a 'drag crosshair'-method.\n\nIf 'preferredBackgroundCategory' is set, the element will attempt to pick a background layer of that category.",
"anyOf": [
{
"type": "object",
"properties": {
"preferredBackground": {
"description": "The type of background picture",
"anyOf": [
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "string"
}
]
},
"snapToLayer": {
"description": "If specified, these layers will be shown to and the new point will be snapped towards it",
"anyOf": [
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "string"
}
]
},
"maxSnapDistance": {
"description": "If specified, a new point will only be snapped if it is within this range.\nDistance in meter\n\nDefault: 10",
"type": "number"
}
},
"required": [
"preferredBackground"
]
},
{
"enum": [
true
],
"type": "boolean"
}
]
}
},
"required": [
"tags",
"title"
]
}
},
"tagRenderings": {
"description": "All the tag renderings.\nA tag rendering is a block that either shows the known value or asks a question.\n\nRefer to the class `TagRenderingConfigJson` to see the possibilities.\n\nNote that we can also use a string here - where the string refers to a tag rendering defined in `assets/questions/questions.json`,\nwhere a few very general questions are defined e.g. website, phone number, ...\nFurthermore, _all_ the questions of another layer can be reused with `otherlayer.*`\nIf you need only a single of the tagRenderings, use `otherlayer.tagrenderingId`\nIf one or more questions have a 'group' or 'label' set, select all the entries with the corresponding group or label with `otherlayer.*group`\nRemark: if a tagRendering is 'lent' from another layer, the 'source'-tags are copied and added as condition.\nIf they are not wanted, remove them with an override\n\nA special value is 'questions', which indicates the location of the questions box. If not specified, it'll be appended to the bottom of the featureInfobox.\n\nAt last, one can define a group of renderings where parts of all strings will be replaced by multiple other strings.\nThis is mainly create questions for a 'left' and a 'right' side of the road.\nThese will be grouped and questions will be asked together",
"type": "array",
"items": {
"anyOf": [
{
"$ref": "#/definitions/QuestionableTagRenderingConfigJson"
},
{
"type": "object",
"properties": {
"builtin": {
"anyOf": [
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "string"
}
]
},
"override": {
"$ref": "#/definitions/Partial<QuestionableTagRenderingConfigJson>"
}
},
"required": [
"builtin",
"override"
]
},
{
"$ref": "#/definitions/default<(string|QuestionableTagRenderingConfigJson|{builtin:string;override:Partial<QuestionableTagRenderingConfigJson>;})[]>"
},
{
"type": "string"

View file

@ -672,7 +672,100 @@
},
"additionalProperties": false
},
"default<(string|QuestionableTagRenderingConfigJson|{builtin:string;override:any;})[]>": {
"Partial<QuestionableTagRenderingConfigJson>": {
"type": "object",
"properties": {
"question": {
"description": "If it turns out that this tagRendering doesn't match _any_ value, then we show this question.\nIf undefined, the question is never asked and this tagrendering is read-only"
},
"freeform": {
"description": "Allow freeform text input from the user",
"type": "object",
"properties": {
"key": {
"type": "string"
},
"type": {
"description": "The type of the text-field, e.g. 'string', 'nat', 'float', 'date',...\nSee Docs/SpecialInputElements.md and UI/Input/ValidatedTextField.ts for supported values",
"type": "string"
},
"placeholder": {
"description": "A (translated) text that is shown (as gray text) within the textfield"
},
"helperArgs": {
"description": "Extra parameters to initialize the input helper arguments.\nFor semantics, see the 'SpecialInputElements.md'",
"type": "array",
"items": {}
},
"addExtraTags": {
"description": "If a value is added with the textfield, these extra tag is addded.\nUseful to add a 'fixme=freeform textfield used - to be checked'",
"type": "array",
"items": {
"type": "string"
}
},
"inline": {
"description": "When set, influences the way a question is asked.\nInstead of showing a full-widht text field, the text field will be shown within the rendering of the question.\n\nThis combines badly with special input elements, as it'll distort the layout.",
"type": "boolean"
},
"default": {
"description": "default value to enter if no previous tagging is present.\nNormally undefined (aka do not enter anything)",
"type": "string"
}
},
"required": [
"key"
]
},
"multiAnswer": {
"description": "If true, use checkboxes instead of radio buttons when asking the question",
"type": "boolean"
},
"mappings": {
"description": "Allows fixed-tag inputs, shown either as radiobuttons or as checkboxes",
"type": "array",
"items": {
"$ref": "#/definitions/MappingConfigJson"
}
},
"id": {
"description": "The id of the tagrendering, should be an unique string.\nUsed to keep the translations in sync. Only used in the tagRenderings-array of a layerConfig, not requered otherwise.\n\nUse 'questions' to trigger the question box of this group (if a group is defined)",
"type": "string"
},
"group": {
"description": "If 'group' is defined on many tagRenderings, these are grouped together when shown. The questions are grouped together as well.\nThe first tagRendering of a group will always be a sticky element.",
"type": "string"
},
"labels": {
"description": "A list of labels. These are strings that are used for various purposes, e.g. to filter them away",
"type": "array",
"items": {
"type": "string"
}
},
"render": {
"description": "Renders this value. Note that \"{key}\"-parts are substituted by the corresponding values of the element.\nIf neither 'textFieldQuestion' nor 'mappings' are defined, this text is simply shown as default value.\n\nNote that this is a HTML-interpreted value, so you can add links as e.g. '<a href='{website}'>{website}</a>' or include images such as `This is of type A <br><img src='typeA-icon.svg' />`\ntype: rendered"
},
"condition": {
"description": "Only show this tagrendering (or ask the question) if the selected object also matches the tags specified as `condition`.\n\nThis is useful to ask a follow-up question.\nFor example, within toilets, asking _where_ the diaper changing table is is only useful _if_ there is one.\nThis can be done by adding `\"condition\": \"changing_table=yes\"`\n\nA full example would be:\n```json\n {\n \"question\": \"Where is the changing table located?\",\n \"render\": \"The changing table is located at {changing_table:location}\",\n \"condition\": \"changing_table=yes\",\n \"freeform\": {\n \"key\": \"changing_table:location\",\n \"inline\": true\n },\n \"mappings\": [\n {\n \"then\": \"The changing table is in the toilet for women.\",\n \"if\": \"changing_table:location=female_toilet\"\n },\n {\n \"then\": \"The changing table is in the toilet for men.\",\n \"if\": \"changing_table:location=male_toilet\"\n },\n {\n \"if\": \"changing_table:location=wheelchair_toilet\",\n \"then\": \"The changing table is in the toilet for wheelchair users.\",\n },\n {\n \"if\": \"changing_table:location=dedicated_room\",\n \"then\": \"The changing table is in a dedicated room. \",\n }\n ],\n \"id\": \"toilet-changing_table:location\"\n },\n```",
"anyOf": [
{
"$ref": "#/definitions/AndTagConfigJson",
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"$ref": "#/definitions/OrTagConfigJson",
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"type": "string"
}
]
}
},
"additionalProperties": false
},
"default<(string|QuestionableTagRenderingConfigJson|{builtin:string;override:Partial<QuestionableTagRenderingConfigJson>;})[]>": {
"description": "Rewrites and multiplies the given renderings of type T.\n\nThis can be used for introducing many similar questions automatically,\nwhich also makes translations easier.\n\n(Note that the key does _not_ need to be wrapped in {}. \nHowever, we recommend to use them if the key is used in a translation, as missing keys will be picked up and warned for by the translation scripts)\n\nFor example:\n\n```\n{\n rewrite: {\n sourceString: [\"key\", \"a|b|c\"],\n into: [\n [\"X\", 0]\n [\"Y\", 1],\n [\"Z\", 2]\n ],\n renderings: [{\n \"key\":\"a|b|c\"\n }]\n }\n}\n```\nwill result in _three_ copies (as the values to rewrite into have three values, namely:\n\n[\n {\n # The first pair: key --> X, a|b|c --> 0\n \"X\": 0\n },\n {\n \"Y\": 1\n },\n {\n \"Z\": 2\n }\n\n]",
"type": "object",
"properties": {
@ -711,7 +804,9 @@
"builtin": {
"type": "string"
},
"override": {}
"override": {
"$ref": "#/definitions/Partial<QuestionableTagRenderingConfigJson>"
}
},
"required": [
"builtin",

View file

@ -661,7 +661,99 @@ export default {
}
}
},
"default<(string|QuestionableTagRenderingConfigJson|{builtin:string;override:any;})[]>": {
"Partial<QuestionableTagRenderingConfigJson>": {
"type": "object",
"properties": {
"question": {
"description": "If it turns out that this tagRendering doesn't match _any_ value, then we show this question.\nIf undefined, the question is never asked and this tagrendering is read-only"
},
"freeform": {
"description": "Allow freeform text input from the user",
"type": "object",
"properties": {
"key": {
"type": "string"
},
"type": {
"description": "The type of the text-field, e.g. 'string', 'nat', 'float', 'date',...\nSee Docs/SpecialInputElements.md and UI/Input/ValidatedTextField.ts for supported values",
"type": "string"
},
"placeholder": {
"description": "A (translated) text that is shown (as gray text) within the textfield"
},
"helperArgs": {
"description": "Extra parameters to initialize the input helper arguments.\nFor semantics, see the 'SpecialInputElements.md'",
"type": "array",
"items": {}
},
"addExtraTags": {
"description": "If a value is added with the textfield, these extra tag is addded.\nUseful to add a 'fixme=freeform textfield used - to be checked'",
"type": "array",
"items": {
"type": "string"
}
},
"inline": {
"description": "When set, influences the way a question is asked.\nInstead of showing a full-widht text field, the text field will be shown within the rendering of the question.\n\nThis combines badly with special input elements, as it'll distort the layout.",
"type": "boolean"
},
"default": {
"description": "default value to enter if no previous tagging is present.\nNormally undefined (aka do not enter anything)",
"type": "string"
}
},
"required": [
"key"
]
},
"multiAnswer": {
"description": "If true, use checkboxes instead of radio buttons when asking the question",
"type": "boolean"
},
"mappings": {
"description": "Allows fixed-tag inputs, shown either as radiobuttons or as checkboxes",
"type": "array",
"items": {
"$ref": "#/definitions/MappingConfigJson"
}
},
"id": {
"description": "The id of the tagrendering, should be an unique string.\nUsed to keep the translations in sync. Only used in the tagRenderings-array of a layerConfig, not requered otherwise.\n\nUse 'questions' to trigger the question box of this group (if a group is defined)",
"type": "string"
},
"group": {
"description": "If 'group' is defined on many tagRenderings, these are grouped together when shown. The questions are grouped together as well.\nThe first tagRendering of a group will always be a sticky element.",
"type": "string"
},
"labels": {
"description": "A list of labels. These are strings that are used for various purposes, e.g. to filter them away",
"type": "array",
"items": {
"type": "string"
}
},
"render": {
"description": "Renders this value. Note that \"{key}\"-parts are substituted by the corresponding values of the element.\nIf neither 'textFieldQuestion' nor 'mappings' are defined, this text is simply shown as default value.\n\nNote that this is a HTML-interpreted value, so you can add links as e.g. '<a href='{website}'>{website}</a>' or include images such as `This is of type A <br><img src='typeA-icon.svg' />`\ntype: rendered"
},
"condition": {
"description": "Only show this tagrendering (or ask the question) if the selected object also matches the tags specified as `condition`.\n\nThis is useful to ask a follow-up question.\nFor example, within toilets, asking _where_ the diaper changing table is is only useful _if_ there is one.\nThis can be done by adding `\"condition\": \"changing_table=yes\"`\n\nA full example would be:\n```json\n {\n \"question\": \"Where is the changing table located?\",\n \"render\": \"The changing table is located at {changing_table:location}\",\n \"condition\": \"changing_table=yes\",\n \"freeform\": {\n \"key\": \"changing_table:location\",\n \"inline\": true\n },\n \"mappings\": [\n {\n \"then\": \"The changing table is in the toilet for women.\",\n \"if\": \"changing_table:location=female_toilet\"\n },\n {\n \"then\": \"The changing table is in the toilet for men.\",\n \"if\": \"changing_table:location=male_toilet\"\n },\n {\n \"if\": \"changing_table:location=wheelchair_toilet\",\n \"then\": \"The changing table is in the toilet for wheelchair users.\",\n },\n {\n \"if\": \"changing_table:location=dedicated_room\",\n \"then\": \"The changing table is in a dedicated room. \",\n }\n ],\n \"id\": \"toilet-changing_table:location\"\n },\n```",
"anyOf": [
{
"$ref": "#/definitions/AndTagConfigJson",
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"$ref": "#/definitions/OrTagConfigJson",
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
},
{
"type": "string"
}
]
}
}
},
"default<(string|QuestionableTagRenderingConfigJson|{builtin:string;override:Partial<QuestionableTagRenderingConfigJson>;})[]>": {
"description": "Rewrites and multiplies the given renderings of type T.\n\nThis can be used for introducing many similar questions automatically,\nwhich also makes translations easier.\n\n(Note that the key does _not_ need to be wrapped in {}. \nHowever, we recommend to use them if the key is used in a translation, as missing keys will be picked up and warned for by the translation scripts)\n\nFor example:\n\n```\n{\n rewrite: {\n sourceString: [\"key\", \"a|b|c\"],\n into: [\n [\"X\", 0]\n [\"Y\", 1],\n [\"Z\", 2]\n ],\n renderings: [{\n \"key\":\"a|b|c\"\n }]\n }\n}\n```\nwill result in _three_ copies (as the values to rewrite into have three values, namely:\n\n[\n {\n # The first pair: key --> X, a|b|c --> 0\n \"X\": 0\n },\n {\n \"Y\": 1\n },\n {\n \"Z\": 2\n }\n\n]",
"type": "object",
"properties": {
@ -700,7 +792,9 @@ export default {
"builtin": {
"type": "string"
},
"override": {}
"override": {
"$ref": "#/definitions/Partial<QuestionableTagRenderingConfigJson>"
}
},
"required": [
"builtin",

View file

@ -287,9 +287,9 @@ export interface LayerConfigJson {
*/
tagRenderings?:
(string
| { builtin: string | string[], override: any }
| { builtin: string | string[], override: Partial<QuestionableTagRenderingConfigJson> }
| QuestionableTagRenderingConfigJson
| RewritableConfigJson<(string | { builtin: string, override: any } | QuestionableTagRenderingConfigJson)[]>
| RewritableConfigJson<(string | { builtin: string, override: Partial<QuestionableTagRenderingConfigJson> } | QuestionableTagRenderingConfigJson)[]>
) [],

View file

@ -150,7 +150,7 @@ export interface LayoutConfigJson {
*
* In the above scenario, `sometagrendering` will be added at the beginning of the tagrenderings of every layer
*/
overrideAll?: any;
overrideAll?: Partial<LayerConfigJson>;
/**
* The id of the default background. BY default: vanilla OSM

File diff suppressed because it is too large Load diff