Search docs

Structured search

Geocoding from separate address fields.

By ยท Updated

GET /v1/search/structured takes the parts of an address in separate fields. Set at least one of address, locality, region, postalcode or country; otherwise the request fails with 400.

Parameters

ParameterTypeMeaning
addressstringHouse number and street, or a venue name.
neighbourhoodstringNeighbourhood.
boroughstringBorough.
localitystringCity or town.
countystringCounty.
regionstringState or province.
postalcodestringPostal code.
countrystringCountry name, or an ISO 3166-1 alpha-2 code. A two-letter code filters by country instead of matching words.

size, layers, boundary.country and the focus point work as in Search.

Example

curl 'http://localhost:4000/v1/search/structured?locality=pune&address=fc%20road&size=2'
{
  "bbox": [
    73.8411071,
    18.5197804,
    73.8434839,
    18.5289175
  ],
  "features": [
    {
      "geometry": {
        "coordinates": [
          73.8434839,
          18.5289175
        ],
        "type": "Point"
      },
      "properties": {
        "confidence": 1.0,
        "country": "India",
        "country_code": "IN",
        "county": "Pune",
        "gid": "geolith:venue:-6291417109141549192",
        "id": "-6291417109141549192",
        "importance": 0.9962999820709229,
        "label": "FC Road Social, Pune, Maharashtra, India",
        "layer": "venue",
        "locality": "Pune",
        "name": "FC Road Social",
        "region": "Maharashtra",
        "source": "geolith"
      },
      "type": "Feature"
    },
    {
      "geometry": {
        "coordinates": [
          73.8411071,
          18.5197804
        ],
        "type": "Point"
      },
      "properties": {
        "confidence": 1.0,
        "country": "India",
        "country_code": "IN",
        "county": "Pune",
        "gid": "geolith:venue:-9143424206843833411",
        "id": "-9143424206843833411",
        "importance": 0.9810000061988831,
        "label": "Aurelia Fc Road Pune, Pune, Maharashtra, India",
        "layer": "venue",
        "locality": "Pune",
        "name": "Aurelia Fc Road Pune",
        "region": "Maharashtra",
        "source": "geolith"
      },
      "type": "Feature"
    }
  ],
  "geocoding": {
    "attribution": "https://console.geolith.app/attribution",
    "engine": {
      "name": "geolith-search",
      "version": "0.1.0"
    },
    "query": {
      "fields": [
        "fc road",
        "pune"
      ],
      "ranking": "importance",
      "size": 2
    },
    "version": "0.2"
  },
  "type": "FeatureCollection"
}

The response is trimmed to two features.

Every word of every field is required first. When that finds nothing, the query relaxes to about three quarters of the words.