mapcomplete/assets/layers/note_import/note_import.json

85 lines
No EOL
2.6 KiB
JSON

{
"id": "note_import",
"name": {
"en": "Possible bookcases"
},
"description": "Template for note note imports.",
"source": {
"osmTags": {
"and": [
"id~*"
]
},
"geoJson": "https://api.openstreetmap.org/api/0.6/notes.json?closed=0&bbox={x_min},{y_min},{x_max},{y_max}",
"geoJsonZoomLevel": 12,
"maxCacheAge": 0
},
"minzoom": 10,
"title": {
"render": {
"en": "Possible feature"
}
},
"calculatedTags": [
"_first_comment:=feat.get('comments')[0].text.toLowerCase()",
"_trigger_index:=(() => {const lines = feat.properties['_first_comment'].split('\\n'); const matchesMapCompleteURL = lines.map(l => l.match(\".*https://mapcomplete.osm.be/\\([a-zA-Z_-]+\\)\\(.html\\).*#import\")); const matchedIndexes = matchesMapCompleteURL.map((doesMatch, i) => [doesMatch !== null, i]).filter(v => v[0]).map(v => v[1]); return matchedIndexes[0] })()",
"_intro:=(() => {const lines = feat.properties['_first_comment'].split('\\n'); lines.splice(feat.get('_trigger_index')-1, lines.length); return lines.map(l => l == '' ? '<br/>' : l).join('');})()",
"_tags:=(() => {let lines = feat.properties['_first_comment'].split('\\n').map(l => l.trim()); lines.splice(0, feat.get('_trigger_index') + 1); lines = lines.filter(l => l != ''); return lines.join(';');})()"
],
"isShown": {
"render": "yes",
"mappings": [
{
"if": "_trigger_index=",
"then": "no"
}
]
},
"titleIcons": [
{
"render": "<a href='https://openstreetmap.org/note/{id}' target='_blank'><img src='./assets/svg/osm-logo-us.svg'></a>"
}
],
"tagRenderings": [
{
"id": "conversation",
"render": "{visualize_note_comments(comments,1)}"
},
{
"id": "Intro",
"render": "{_intro}"
},
{
"id": "import",
"render": "{import_button(public_bookcase, _tags, There might be a public bookcase here,./assets/svg/addSmall.svg,,,id)}"
},
{
"id": "close_note_",
"render": "{close_note(Does not exist<br/>, ./assets/svg/close.svg, id, This feature does not exist)}"
},
{
"id": "close_note_mapped",
"render": "{close_note(Already mapped, ./assets/svg/checkmark.svg, id, Already mapped)}"
},
{
"id": "comment",
"render": "{add_note_comment()}"
},
{
"id": "add_image",
"render": "{add_image_to_note()}"
}
],
"mapRendering": [
{
"location": [
"point",
"centroid"
],
"icon": {
"render": "teardrop:#3333cc"
},
"iconSize": "40,40,bottom"
}
]
}