Address Autocompletion Based on OpenStreetMap Data

The address autocomplete API takes the string the user typed in the input field and “guesses” which addresses he could have meant.

Request

  • input type string

    The string the user typed in the input field

Response

The response contains a list of guesses in the guesses field.

  • pos see Position

    The string the user typed in the input field

  • name type string

    The street name.

  • type type string

    The type of the address. May be street or place.

  • regions see Region

    Regions (city, country, etc.) the address is located in.

Region

Address Guesser Request Example
{
  "destination": {
    "type": "Module",
    "target": "/address"
  },
  "content_type": "AddressRequest",
  "content": {
    "input": "Agnestraße Zur"
  }
}
Address Guesser Response Example
{
  "destination": {
    "target": ""
  },
  "content_type": "AddressResponse",
  "content": {
    "guesses": [
      {
        "pos": {
          "lat": 47.377901,
          "lng": 8.514507
        },
        "name": "Agnesstrasse",
        "type": "street",
        "regions": [
          {
            "name": "Hard",
            "admin_level": 10
          },
          {
            "name": "Sihlfeld",
            "admin_level": 10
          },
          {
            "name": "Aussersihl",
            "admin_level": 9
          },
          {
            "name": "Wiedikon",
            "admin_level": 9
          },
          {
            "name": "Zürich",
            "admin_level": 8
          },
          {
            "name": "Bezirk Zürich",
            "admin_level": 6
          },
          {
            "name": "Zürich",
            "admin_level": 4
          },
          {
            "name": "Schweiz/Suisse/Svizzera/Svizra",
            "admin_level": 2
          }
        ]
      }
    ]
  },
  "id": 1
}