{
  "id": "uk_addresses",
  "title": {
    "en": "Addresses in Great Britain",
    "de": "Adressen in Großbritannien",
    "it": "Indirizzi UK",
    "id": "Alamat Inggris"
  },
  "mustHaveLanguage": [
    "en"
  ],
  "description": {
    "en": "Help us collect addresses and make them freely available. Each address contributed will be added to OpenStreetMap so you will need to create an account and log in before you start. Please do not copy addresses from the internet or other sources subject to copyright. This website works well on mobile so a good option is to contibute the addresses closest to you."
  },
  "shortDescription": {
    "en": "Help to build an open dataset of addresses in Great Britain",
    "de": "Helfen Sie beim Aufbau eines offenen Datensatzes britischer Adressen",
    "it": "Aiuta a costruire un dataset libero per gli indirizzi nel Regno Unito"
  },
  "icon": "./assets/themes/uk_addresses/housenumber_unknown.svg",
  "startZoom": 7,
  "startLat": 53.21261,
  "startLon": -1.47216,
  "credits": [
    "Pieter Vander Vennet, Rob Nickerson, Russ Garrett"
  ],
  "hideFromOverview": true,
  "layers": [
    {
      "id": "raw_inspire_polygons",
      "description": "External dataset: inspire polygon",
      "source": {
        "geoJson": "https://osm-uk-addresses.russss.dev/inspire/{z}/{x}/{y}.json",
        "osmTags": "inspireid~*",
        "geoJsonZoomLevel": 18
      },
      "minzoom": 18,
      "calculatedTags": [
        "_has_address=overlapWith(feat)('address').length > 0"
      ],
      "shownByDefault": false,
      "name": {
        "en": "Inspire polygons"
      },
      "pointRendering": null,
      "lineRendering": [
        {
          "width": 2,
          "color": {
            "render": "#00f",
            "mappings": [
              {
                "if": "_has_address=true",
                "then": "#0f0"
              }
            ]
          }
        }
      ]
    },
    {
      "id": "to_import",
      "source": {
        "geoJson": "https://osm-uk-addresses.russss.dev/addresses/{z}/{x}/{y}.json",
        "osmTags": {
          "and": [
            "urpn_count~*",
            "id!~node/.*"
          ]
        },
        "geoJsonZoomLevel": 16
      },
      "name": "Addresses to check",
      "minzoom": 18,
      "title": {
        "render": {
          "en": "This address needs adding"
        }
      },
      "tagRenderings": [
        {
          "id": "uk_addresses_explanation",
          "render": {
            "en": "We think there should be an address here. Please click below to add it."
          }
        },
        {
          "id": "uk_addresses_embedding_outline",
          "render": "<b>Warning: </b>This point lies within a building or area for which we already have an address. You should only add this address if it is different. <br>The number and street name we have for the <a href='#{_embedding_object:id}'>existing address</a> is <b>{_embedding_object:addr:housenumber} {_embedding_object:addr:street}</b>",
          "mappings": [
            {
              "if": "_embedding_object:id=true",
              "then": {
                "en": "<b>Warning: </b>The property boundary containing this point already contains at least one recorded address. You should only add this address if it is different."
              }
            },
            {
              "if": "_embedding_object:id=false",
              "then": {
                "en": "We checked our data and found no other address within the same property boundary. If you know the details for this address, please add it."
              }
            }
          ],
          "condition": "_embedding_object:id~*"
        },
        {
          "id": "uk_addresses_import_button",
          "render": {
            "special": {
              "type": "import_button",
              "targetLayer": "address",
              "tags": "urpn_count=$urpn_count;ref:GB:uprn=$ref:GB:uprn$",
              "text": "Add this address",
              "icon": "./assets/themes/uk_addresses/housenumber_add.svg"
            }
          }
        }
      ],
      "calculatedTags": [
        "_embedding_object=overlapWith(feat)('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=overlapWith(feat)('raw_inspire_polygons')[0]?.feat?.properties?._has_address",
        "_embedding_object:id=get(feat, '_embedding_object')?.id ?? feat.properties._embedding_inspire_polygon_has_address"
      ],
      "filter": [
        {
          "id": "to_handle",
          "options": [
            {
              "default": true,
              "question": "Only show non-matched objects",
              "osmTags": {
                "and": [
                  "_imported=",
                  {
                    "or": [
                      "_embedding_object:id=",
                      "_embedding_object:id=false"
                    ]
                  }
                ]
              }
            }
          ]
        }
      ],
      "description": "Alamat",
      "pointRendering": [
        {
          "marker": [
            {
              "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": "40,40",
          "location": [
            "point",
            "centroid"
          ],
          "anchor": "center"
        }
      ],
      "lineRendering": [
        {}
      ]
    },
    {
      "id": "uk_address",
      "name": {
        "en": "Known addresses in OSM"
      },
      "minzoom": 18,
      "source": {
        "osmTags": {
          "or": [
            "addr:unit~*",
            "addr:flats~*",
            "addr:housename~*",
            "addr:housenumber~*",
            "addr:place~*",
            "addr:substreet~*",
            "addr:street~*",
            "addr:parentstreet~*",
            "addr:suburb~*",
            "addr:city~*",
            "addr:postcode~*",
            "fixme:addr~*",
            "urpn_count~*"
          ]
        }
      },
      "title": {
        "render": {
          "en": "Review and update the address"
        }
      },
      "description": {
        "en": "Addresses",
        "nl": "Adressen",
        "de": "Adressen",
        "ru": "Адреса",
        "zh_Hant": "地址",
        "hu": "Címek"
      },
      "calculatedTags": [
        "_closest_3_street_names=closestn(feat)('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": [
        "questions",
        {
          "id": "preview",
          "render": {
            "en": "<div>The envelope below shows the address that we have recorded. You can change this by answering any remaining questions above, or by clicking the pencil icons below. We do not need you to provide a recipient's name or any of the parts shown in <span style='color: #4e7ce8'>[blue]</span>.</div><div style='background: #f1d592; min-height: 270px; border-radius: 2px; padding: 1rem 1rem 2rem 7rem; margin: 1rem; box-shadow: 0 2px 5px 0px rgba(0,0,0,.6)' class='flex flex-col'><img src='./assets/themes/uk_addresses/stamp-outline.png' class='self-end w-16'/><div>{addr:unit} {addr:housename}</div><div>{addr:housenumber} {addr:street}</div><div>{addr:parentstreet}</div><div style='color: #4e7ce8'>[Suburb]</div><div  style='color: #4e7ce8'>[Town]</div><div style='color: #4e7ce8'>[Postal code]</div></div>"
          },
          "mappings": [
            {
              "#": "ignore-image-in-then",
              "if": "addr:substreet~*",
              "then": "<div>The envelope below shows the address that we have recorded. You can change this by answering any remaining questions above, or by clicking the pencil icons below. We do not need you to provide a recipient's name or any of the parts shown in <span style='color: #4e7ce8'>[blue]</span>.</div><div style='background: #f1d592; min-height: 270px; border-radius: 2px; padding: 1rem 1rem 2rem 7rem; margin: 1rem; box-shadow: 0 2px 5px 0px rgba(0,0,0,.6)' class='flex flex-col'><img src='./assets/themes/uk_addresses/stamp-outline.png' class='self-end w-16'/><div>{addr:unit} {addr:housename}</div><div>{addr:housenumber} {addr:substreet}</div><div>{addr:street}</div><div>{addr:parentstreet}</div><div style='color: #4e7ce8'>[Suburb]</div><div style='color: #4e7ce8'>[Town]</div><div style='color: #4e7ce8'>[Postal code]</div></div>"
            }
          ]
        },
        {
          "id": "uk_addresses_unit",
          "render": "<div class='subtle'>Sub-unit (e.g. 1, Flat 2, Unit C)</div><div><b>{addr:unit}</b></div>",
          "question": {
            "en": "What is the sub-unit for this address? "
          },
          "freeform": {
            "key": "addr:unit",
            "placeholder": "Sub-unit (e.g. 1, Flat 2, Unit C)",
            "addExtraTags": [
              "not:addr:unit="
            ]
          },
          "mappings": [
            {
              "if": "not:addr:unit=yes",
              "then": "<div class='subtle'>Sub-unit (e.g. 1, Flat 2, Unit C)</div><div>There is no sub-unit within this address</div>",
              "hideInAnswer": true
            },
            {
              "if": "not:addr:unit=yes",
              "then": "There is no sub-unit within this address",
              "addExtraTags": [
                "addr:unit="
              ]
            },
            {
              "if": "addr:unit=",
              "then": "<div class='subtle'>Sub-unit (e.g. 1, Flat 2, Unit C)</div>",
              "hideInAnswer": true
            }
          ],
          "condition": {
            "or": [
              "addr:housenumber~*",
              "addr:housename~*",
              "addr:substreet~*"
            ]
          },
          "questionHint": {
            "en": "Some named building or large complexes are split into sub-units"
          }
        },
        {
          "id": "uk_addresses_housename",
          "question": "What is the house or building name for this address?",
          "questionHint": "As shown on a sign. Please do NOT add names of the people who live here!",
          "render": "<div class='subtle'>House or building name</div><div><b>{addr:housename}</b></div>",
          "freeform": {
            "key": "addr:housename",
            "placeholder": "Name (e.g. Rose Cottage, Broadcasting House, Acme Corp HQ)",
            "addExtraTags": [
              "nohousename="
            ]
          },
          "mappings": [
            {
              "if": {
                "and": [
                  "nohousename=yes",
                  "addr:housename="
                ]
              },
              "then": "<div class='subtle'>House or building name</div><div>This building has no housename</div>",
              "hideInAnswer": true
            },
            {
              "if": {
                "and": [
                  "nohousename=yes",
                  "addr:housename="
                ]
              },
              "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": "<div class='subtle'>House or building name</div>",
              "hideInAnswer": true
            }
          ]
        },
        {
          "id": "uk_addresses_housenumber",
          "render": "<div class='subtle'>Number (e.g. 1, 1A, 2)</div><div><b>{addr:housenumber}</b></div>",
          "question": {
            "en": "What is the house or building number for this address?"
          },
          "freeform": {
            "key": "addr:housenumber",
            "placeholder": "Number (e.g. 1, 1A, 2)",
            "addExtraTags": [
              "nohousenumber="
            ]
          },
          "mappings": [
            {
              "if": "nohousenumber=yes",
              "then": {
                "en": "<div class='subtle'>Number (e.g. 1, 1A, 2)</div><div>This building has no house number</div>"
              },
              "hideInAnswer": true
            },
            {
              "if": "nohousenumber=yes",
              "then": {
                "en": "This building has no house number",
                "nl": "Dit gebouw heeft geen huisnummer",
                "de": "Dieses Gebäude hat keine Hausnummer"
              },
              "addExtraTags": [
                "addr:housenumber="
              ]
            }
          ]
        },
        {
          "id": "uk_addresses_placename",
          "question": {
            "en": "What is the place or locality for this address?"
          },
          "render": {
            "en": "<div class='subtle'>Place (e.g. Castle Mews, West Business Park)</div><div><b>{addr:substreet}</b></div>"
          },
          "freeform": {
            "key": "addr:substreet",
            "placeholder": "Place (e.g. The Cross, West Business Park, Castle Mews)",
            "addExtraTags": [
              "not:addr:parentstreet=",
              "addr:parentstreet:={addr:street}",
              "addr:street=",
              "not:addr:substreet="
            ]
          },
          "mappings": [
            {
              "if": "not:addr:substreet=yes",
              "then": {
                "en": "<div class='subtle'>Place (e.g. Castle Mews, West Business Park)</div><div>No extra place name is given or needed</div>"
              },
              "hideInAnswer": true
            },
            {
              "if": "not:addr:substreet=yes",
              "then": {
                "en": "No extra place name is given or needed"
              },
              "addExtraTags": [
                "addr:substreet="
              ]
            },
            {
              "if": "addr:substreet=",
              "then": {
                "en": "<div class='subtle'>Place (e.g. Castle Mews, West Business Park)</div>"
              },
              "hideInAnswer": true
            }
          ],
          "condition": "addr:parentstreet=",
          "questionHint": {
            "en": "This is additional information that appears before (or instead of) a street name in the address"
          }
        },
        {
          "id": "uk_addresses_placename_with_parent",
          "question": {
            "en": "What is the place or locality for this address?"
          },
          "render": {
            "en": "<div class='subtle'>Place (e.g. Castle Mews, West Business Park)</div><div><b>{addr:substreet}</b></div>"
          },
          "freeform": {
            "key": "addr:substreet",
            "placeholder": "Place (e.g. The Cross, West Business Park, Castle Mews)",
            "addExtraTags": [
              "addr:street=",
              "not:addr:substreet="
            ]
          },
          "mappings": [
            {
              "if": "not:addr:substreet=yes",
              "then": {
                "en": "<div class='subtle'>Place (e.g. Castle Mews, West Business Park)</div><div>No extra place name is given or needed</div>"
              },
              "hideInAnswer": true
            },
            {
              "if": "not:addr:substreet=yes",
              "then": {
                "en": "No extra place name is given or needed"
              },
              "addExtraTags": [
                "addr:substreet="
              ]
            },
            {
              "if": "addr:substreet=",
              "then": {
                "en": "<div class='subtle'>Place (e.g. Castle Mews, West Business Park)</div>"
              },
              "hideInAnswer": true
            }
          ],
          "condition": {
            "or": [
              {
                "and": [
                  "addr:parentstreet~*",
                  "addr:street="
                ]
              },
              {
                "and": [
                  "addr:parentstreet~*",
                  "addr:street~*",
                  "addr:substreet~*"
                ]
              }
            ]
          },
          "questionHint": {
            "en": "This is additional information that appears before (or instead of) a street name in the address"
          }
        },
        {
          "id": "uk_addresses_street",
          "render": "<div class='subtle'>Street name</div><div><b>{addr:street}</b></div>",
          "question": {
            "en": "What is the street name for this address?"
          },
          "freeform": {
            "key": "addr:street",
            "placeholder": "Other (please specify)"
          },
          "mappings": [
            {
              "if": "addr:street:={_closest_street:0:name}",
              "then": "<div class='subtle'>Street name</div><div><b>{_closest_street:0:name}</b></div>",
              "hideInAnswer": true
            },
            {
              "if": "addr:street:={_closest_street:1:name}",
              "then": "<div class='subtle'>Street name</div><div><b>{_closest_street:1:name}</b></div>",
              "hideInAnswer": true
            },
            {
              "if": "addr:street:={_closest_street:2:name}",
              "then": "<div class='subtle'>Street name</div><div><b>{_closest_street:2:name}</b></div>",
              "hideInAnswer": true
            },
            {
              "if": "addr:street:={_closest_street:0:name}",
              "then": "<b>{_closest_street:0:name}</b>",
              "hideInAnswer": "_closest_street:0:name="
            },
            {
              "if": "addr:street:={_closest_street:1:name}",
              "then": "<b>{_closest_street:1:name}</b>",
              "hideInAnswer": "_closest_street:1:name="
            },
            {
              "if": "addr:street:={_closest_street:2:name}",
              "then": "<b>{_closest_street:2:name}</b>",
              "hideInAnswer": "_closest_street:2:name="
            }
          ],
          "condition": {
            "or": [
              "addr:street~*",
              "addr:substreet="
            ]
          }
        },
        {
          "id": "uk_addresses_parentstreet",
          "render": "<div class='subtle'>Parent street name</div><div><b>{addr:parentstreet}</b></div>",
          "question": {
            "en": "What is the parent street name for this address?"
          },
          "freeform": {
            "key": "addr:parentstreet",
            "placeholder": "Other (please specify)",
            "addExtraTags": [
              "not:addr:parentstreet="
            ]
          },
          "mappings": [
            {
              "if": "not:addr:parentstreet=yes",
              "then": "<div class='subtle'>Parent street name</div><div>No parent street name is needed within this address</div>",
              "hideInAnswer": true
            },
            {
              "if": "not:addr:parentstreet=yes",
              "then": "No parent street name is needed within this address",
              "addExtraTags": [
                "addr:parentstreet="
              ]
            },
            {
              "if": "addr:parentstreet:={_closest_street:0:name}",
              "then": "<div class='subtle'>Parent street name</div><div><b>{_closest_street:0:name}</b></div>",
              "hideInAnswer": true
            },
            {
              "if": "addr:parentstreet:={_closest_street:1:name}",
              "then": "<div class='subtle'>Parent street name</div><div><b>{_closest_street:1:name}</b></div>",
              "hideInAnswer": true
            },
            {
              "if": "addr:parentstreet:={_closest_street:2:name}",
              "then": "<div class='subtle'>Parent street name</div><div><b>{_closest_street:2:name}</b></div>",
              "hideInAnswer": true
            },
            {
              "if": "addr:parentstreet:={_closest_street:0:name}",
              "then": "<b>{_closest_street:0:name}</b>",
              "hideInAnswer": "_closest_street:0:name="
            },
            {
              "if": "addr:parentstreet:={_closest_street:1:name}",
              "then": "<b>{_closest_street:1:name}</b>",
              "hideInAnswer": "_closest_street:1:name="
            },
            {
              "if": "addr:parentstreet:={_closest_street:2:name}",
              "then": "<b>{_closest_street:2:name}</b>",
              "hideInAnswer": "_closest_street:2:name="
            },
            {
              "if": "addr:parentstreet=",
              "then": {
                "en": "<div class='subtle'>Parent street name</div>"
              },
              "hideInAnswer": true
            }
          ],
          "condition": {
            "or": [
              "addr:parentstreet~*",
              "addr:substreet~*"
            ]
          },
          "questionHint": {
            "en": "This street name will appear after the place name or first street name in the address"
          }
        },
        {
          "id": "fixme",
          "render": "This address is complicated. We have recorded the following description: {fixme:addr}",
          "question": {
            "en": "Please explain what the address is so that someone else can look at it"
          },
          "freeform": {
            "key": "fixme:addr",
            "placeholder": "Type here..."
          },
          "mappings": [
            {
              "if": "fixme:addr=",
              "then": "Complicated address? Please click the pencil and write some text to describe the situation. You can also add a photo below if that helps",
              "hideInAnswer": true
            }
          ]
        },
        {
          "id": "address-sign-image",
          "render": {
            "en": "{image_carousel(image:address)}<br/>{image_upload(image:address, Too complex? Add a photo of the address)}"
          }
        }
      ],
      "pointRendering": [
        {
          "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",
          "marker": [
            {
              "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"
          ],
          "anchor": "center"
        }
      ],
      "lineRendering": [
        {
          "color": {
            "render": "#00f",
            "mappings": [
              {
                "if": {
                  "or": [
                    {
                      "and": [
                        "addr:housenumber=",
                        "nohousenumber!=yes"
                      ]
                    },
                    "addr:street="
                  ]
                },
                "then": "#ff0"
              }
            ]
          },
          "width": "3"
        }
      ],
      "allowMove": {
        "enableRelocation": false,
        "enableImproveAccuracy": true
      }
    },
    "named_streets"
  ],
  "tileLayerSources": [
    {
      "id": "property-boundaries",
      "url": "https://tiles.osmuk.org/PropertyBoundaries/{z}/{x}/{y}.png",
      "isOverlay": true,
      "min_zoom": 18,
      "max_zoom": 20,
      "defaultState": false,
      "name": {
        "en": "Property boundaries by osmuk.org",
        "de": "Grenzverläufe gemäß osmuk.org"
      }
    }
  ],
  "enableShareScreen": false,
  "enableMoreQuests": false,
  "widenFactor": 1.01
}
