{
  "id": "uk_addresses",
  "title": {
    "en": "UK Addresses",
    "de": "Adressen in Großbritannien",
    "it": "Indirizzi UK",
    "id": "Alamat Inggris"
  },
  "mustHaveLanguage": [
    "en"
  ],
  "shortDescription": {
    "en": "Help to build an open dataset of UK addresses",
    "de": "Helfen Sie beim Aufbau eines offenen Datensatzes britischer Adressen",
    "it": "Aiuta a costruire un dataset libero per gli indirizzi nel Regno Unito"
  },
  "description": {
    "en": "Contribute to OpenStreetMap by filling out address information",
    "nl": "Draag bij aan OpenStreetMap door adresinformatie in te vullen",
    "de": "Tragen Sie zu OpenStreetMap bei, indem Sie Adressinformationen ausfüllen",
    "it": "Contribuisci a OpenStreetMap inserendo le informazioni sull’indirizzo",
    "id": "Berkontribusi untuk OpenStreetMap dengan mengisi informasi alamat"
  },
  "maintainer": "Pieter Vander Vennet, Rob Nickerson, Russ Garrett",
  "icon": "./assets/themes/uk_addresses/housenumber_unknown.svg",
  "version": "2021-09-17",
  "startLat": -0.08706,
  "startLon": 51.52224,
  "startZoom": 17,
  "widenFactor": 1.01,
  "socialImage": "",
  "hideFromOverview": true,
  "clustering": {
    "minNeededFeatures": 25,
    "maxZoom": 16
  },
  "tileLayerSources": [
    {
      "id": "property-boundaries",
      "source": "https://tiles.osmuk.org/PropertyBoundaries/{z}/{x}/{y}.png",
      "isOverlay": true,
      "minZoom": 18,
      "maxZoom": 20,
      "defaultState": false,
      "name": {
        "en": "Property boundaries by osmuk.org",
        "de": "Grenzverläufe gemäß osmuk.org"
      }
    }
  ],
  "layers": [
    {
      "id": "raw_inspire_polygons",
      "source": {
        "geoJson": "https://osm-uk-addresses.russss.dev/inspire/{z}/{x}/{y}.json",
        "osmTags": "inspireid~*",
        "geoJsonZoomLevel": 18,
        "isOsmCache": false
      },
      "minzoom": 18,
      "calculatedTags": [
        "_has_address=feat.overlapWith('address').length > 0"
      ],
      "mapRendering": [
        {
          "width": 2,
          "color": {
            "render": "#00f",
            "mappings": [
              {
                "if": "_has_address=true",
                "then": "#0f0"
              }
            ]
          }
        }
      ],
      "shownByDefault": false,
      "name": {
        "en": "Inspire polygons"
      }
    },
    {
      "id": "to_import",
      "source": {
        "geoJson": "https://osm-uk-addresses.russss.dev/addresses/{z}/{x}/{y}.json",
        "osmTags": {
          "and": [
            "ref:GB:inspire~*",
            "id!~node/.*"
          ]
        },
        "geoJsonZoomLevel": 16,
        "isOsmCache": false
      },
      "name": "Addresses to check",
      "minzoom": 14,
      "title": {
        "render": {
          "en": "Address to be determined",
          "id": "Alamat yang diketahui"
        }
      },
      "tagRenderings": [
        {
          "id": "uk_addresses_explanation",
          "render": {
            "en": "There probably is an address here"
          }
        },
        {
          "id": "uk_addresses_embedding_outline",
          "render": "An outline embedding this point with an address already exists in OpenStreetMap.<br>This <a href='https://openstreetmap.org/{_embedding_object:id}' target='blank'>object</a> has address <b>{_embedding_object:addr:street} {_embedding_object:addr:housenumber}</b>",
          "mappings": [
            {
              "if": "_embedding_object:id=true",
              "then": {
                "en": "The INSPIRE-polygon containing this point has at least one address contained"
              }
            },
            {
              "if": "_embedding_object:id=false",
              "then": {
                "en": "The INSPIRE-polygon containing this point has <b>no</b> addresses contained"
              }
            }
          ],
          "condition": "_embedding_object:id~*"
        },
        {
          "id": "uk_addresses_import_button",
          "render": "{import_button(address,ref:GB:inspire=$ref:GB:inspire;ref:GB:uprn=$ref:GB:uprn$, Add this address, ./assets/themes/uk_addresses/housenumber_add.svg)}"
        }
      ],
      "calculatedTags": [
        "_embedding_object=feat.overlapWith('address')[0]?.feat?.properties ?? null",
        "_embedding_object:addr:housenumber=JSON.parse(feat.properties._embedding_object)?.['addr:housenumber']",
        "_embedding_object:addr:street=JSON.parse(feat.properties._embedding_object)?.['addr:street']",
        "_embedding_inspire_polygon_has_address=feat.overlapWith('raw_inspire_polygons')[0]?.feat?.properties?._has_address",
        "_embedding_object:id=feat.get('_embedding_object')?.id ?? feat.properties._embedding_inspire_polygon_has_address"
      ],
      "filter": [
        {
          "id": "to_handle",
          "options": [
            {
              "question": "Only show non-matched objects",
              "osmTags": {
                "and": [
                  "_imported=",
                  {
                    "or": [
                      "_embedding_object:id=",
                      "_embedding_object:id=false"
                    ]
                  }
                ]
              }
            }
          ]
        }
      ],
      "mapRendering": [
        {
          "icon": {
            "render": "./assets/themes/uk_addresses/housenumber_unknown.svg",
            "mappings": [
              {
                "if": {
                  "and": [
                    "_embedding_object:id~*",
                    "_embedding_object:id!=false"
                  ]
                },
                "then": "./assets/themes/uk_addresses/housenumber_unknown_small.svg"
              },
              {
                "if": "_imported=yes",
                "then": "./assets/themes/uk_addresses/housenumber_unknown_small.svg"
              }
            ]
          },
          "iconSize": {
            "render": "40,40,center"
          },
          "location": [
            "point",
            "centroid"
          ]
        }
      ],
      "description": "Alamat"
    },
    {
      "id": "address",
      "name": {
        "en": "Known addresses in OSM",
        "de": "Bekannte Adressen in OSM",
        "zh_Hant": "OSM 上已知的地址",
        "hu": "Ismert címek az OSM-en",
        "nl": "Bekende adressen in OSM"
      },
      "minzoom": 18,
      "source": {
        "osmTags": {
          "or": [
            "addr:housenumber~*",
            "addr:street~*",
            "ref:GB:inspire~*"
          ]
        }
      },
      "title": {
        "render": {
          "en": "Known address",
          "de": "Bekannte Adresse",
          "hu": "Ismert cím",
          "nl": "Bekend adres"
        }
      },
      "description": {
        "en": "Addresses",
        "nl": "Adressen",
        "de": "Adressen",
        "ru": "Адреса",
        "zh_Hant": "地址",
        "hu": "Címek"
      },
      "calculatedTags": [
        "_closest_3_street_names=feat.closestn('named_streets',3, 'name').map(f => f.feat.properties.name)",
        "_closest_street:0:name=JSON.parse(feat.properties._closest_3_street_names)[0]",
        "_closest_street:1:name=JSON.parse(feat.properties._closest_3_street_names)[1]",
        "_closest_street:2:name=JSON.parse(feat.properties._closest_3_street_names)[2]"
      ],
      "tagRenderings": [
        {
          "id": "uk_addresses_explanation_osm",
          "render": {
            "en": "This address is saved in OpenStreetMap",
            "de": "Diese Adresse ist in OpenStreetMap gespeichert"
          }
        },
        {
          "id": "uk_addresses_housenumber",
          "render": {
            "en": "The housenumber is <b>{addr:housenumber}</b>",
            "nl": "Het huisnummer is <b>{addr:housenumber}</b>",
            "de": "Die Hausnummer ist <b>{addr:housenumber}</b>"
          },
          "question": {
            "en": "What is the number of this house?",
            "de": "Wie lautet die Nummer dieses Hauses?"
          },
          "freeform": {
            "key": "addr:housenumber",
            "addExtraTags": [
              "nohousenumber="
            ]
          },
          "mappings": [
            {
              "if": {
                "and": [
                  "nohousenumber=yes"
                ]
              },
              "then": {
                "en": "This building has no house number",
                "nl": "Dit gebouw heeft geen huisnummer",
                "de": "Dieses Gebäude hat keine Hausnummer"
              }
            }
          ]
        },
        {
          "id": "uk_addresses_housename",
          "question": "What is the name of this house?<br/>This is normally indicated on a plaque.<br><div class='subtle'>Do NOT add names of inhabitants!</div>",
          "render": "This house is named <b>{addr:housename}</b>",
          "freeform": {
            "key": "addr:housename",
            "addExtraTags": [
              "nohousename="
            ]
          },
          "mappings": [
            {
              "if": "nohousename=yes",
              "then": "This building has no housename"
            },
            {
              "#": "By adding nohousenumber!=yes, this option will trigger when first added, but will be untriggered if a housenumber is added, resulting in the question poping up!",
              "if": {
                "and": [
                  "addr:housename=",
                  "nohousenumber!=yes"
                ]
              },
              "then": "This building has no housename",
              "hideInAnswer": true
            }
          ]
        },
        {
          "id": "uk_addresses_unit",
          "render": "The sub-part of this address is <b>{addr:unit}</b>",
          "question": {
            "en": "What is the unit indication of this address? <div class='subtle'>This is the letter or number of the letterbox here, if multiple letterboxes share the same street and housenumber. If there are multiple at the same location, add them here with a <b>;</b> between them</div>"
          },
          "freeform": {
            "key": "addr:unit"
          },
          "mappings": [
            {
              "if": "addr:unit=",
              "then": "This address has no subparts. <div class='subtle'>Subparts are e.g. appartment numbers, extra letters or numbers if there are multiple letterboxes, ...</div>"
            }
          ],
          "condition": {
            "or": [
              "addr:housenumber~*",
              "addr:housename~*"
            ]
          }
        },
        {
          "id": "uk_addresses_street",
          "render": {
            "en": "This address is in street <b>{addr:street}</b>",
            "de": "Diese Adresse befindet sich in der Straße <b>{addr:street}</b>"
          },
          "question": {
            "en": "What street is this address located in?",
            "de": "In welcher Straße befindet sich diese Adresse?"
          },
          "freeform": {
            "key": "addr:street"
          },
          "mappings": [
            {
              "if": "addr:street:={_closest_street:0:name}",
              "then": "This address is in street <b>{_closest_street:0:name}</b>",
              "hideInAnswer": "_closest_street:0:name="
            },
            {
              "if": "addr:street:={_closest_street:1:name}",
              "then": "This address is in street <b>{_closest_street:1:name}</b>",
              "hideInAnswer": "_closest_street:1:name="
            },
            {
              "if": "addr:street:={_closest_street:2:name}",
              "then": "This address is in street <b>{_closest_street:2:name}</b>",
              "hideInAnswer": "_closest_street:2:name="
            }
          ]
        },
        {
          "id": "uk_addresses_placename",
          "question": {
            "en": "What is the place or locality?<div class='subtle'>This is additional information if the streetname alone isn't enough to find this address. Typical examples are 'Technology Park', 'XYZ Terrace', ...</div>"
          },
          "render": {
            "en": "The placename is <b>{addr:place}</b>"
          },
          "freeform": {
            "key": "addr:place"
          },
          "mappings": [
            {
              "if": "addr:place=",
              "then": {
                "en": "No extra placename is given or needed"
              }
            }
          ]
        },
        {
          "id": "fixme",
          "render": "<b>This address is complicated - therefore someone has given a description of what should be fixed:</b>{fixme}",
          "question": {
            "en": "What should be fixed here? Please explain what the address is"
          },
          "freeform": {
            "key": "fixme"
          },
          "mappings": [
            {
              "if": "fixme=",
              "then": "Is this address complicated? Write something here to explain this case. An experienced mapper will have a look at it"
            }
          ]
        },
        "questions",
        {
          "id": "address-sign-image",
          "render": {
            "en": "{image_carousel(image:address)}<br/>{image_upload(image:address, Add image of the address)}"
          }
        },
        {
          "id": "preview",
          "render": {
            "en": "To send a letter to this addres, you would write:<div style='background: #fcdf94; border: 2px solid black; border-radius: 1rem; padding: 1.5rem 0.5rem 2rem 8rem; margin: 1rem' class='flex flex-col'><img src='./assets/themes/uk_addresses/stamp.jpg' class='self-end w-16'/><div class='subtle'>Name of the inhabitant</div><div>{addr:housename}</div><div>{addr:unit} {addr:housenumber} {addr:street}</div><div>{addr:place}</div><div class='subtle'>Suburb</div><div class='subtle'>Town</div><div class='subtle'>Postal code</div></div>"
          },
          "mappings": [
            {
              "if": "addr:place~*",
              "then": "To send a letter to this address, you would write:<div style='background: #fcdf94; border: 2px solid black; border-radius: 1rem; padding: 1.5rem 0.5rem 2rem 8rem; margin: 1rem' class='flex flex-col'><img src='./assets/themes/uk_addresses/stamp.jpg' class='self-end w-16'/><div class='subtle'>Name of the inhabitant</div><div>{addr:unit} {addr:housename}</div><div>{addr:housenumber} {addr:place}</div><div>{addr:street}</div><div class='subtle'>Suburb</div><div class='subtle'>Town</div><div class='subtle'>Postal code</div></div>"
            }
          ]
        }
      ],
      "mapRendering": [
        {
          "label": {
            "render": "<div style='margin-top: -42px; color: white' class='rounded-full p-1 font-bold relative'>{addr:housenumber}</div>",
            "condition": "addr:housenumber~*"
          },
          "iconSize": "50,50,center",
          "icon": {
            "render": "./assets/layers/address/housenumber_blank.svg",
            "mappings": [
              {
                "if": {
                  "or": [
                    {
                      "and": [
                        "addr:housenumber=",
                        "nohousenumber!=yes"
                      ]
                    },
                    "addr:street="
                  ]
                },
                "then": "./assets/themes/uk_addresses/housenumber_unknown.svg"
              }
            ]
          },
          "location": [
            "point",
            "centroid"
          ]
        },
        {
          "color": {
            "render": "#00f",
            "mappings": [
              {
                "if": {
                  "or": [
                    {
                      "and": [
                        "addr:housenumber=",
                        "nohousenumber!=yes"
                      ]
                    },
                    "addr:street="
                  ]
                },
                "then": "#ff0"
              }
            ]
          },
          "width": {
            "render": "3"
          }
        }
      ]
    },
    "named_streets"
  ],
  "enableShareScreen": false,
  "enableMoreQuests": false
}