Locations search

Query and search locations using the same technology that powers our Location Finder technology

Search locations

Search locations using a geo-search query (City, State, Postal code) or using specific latitude and longitude coordinates.

Locations are sorted by distance from the searched location.

GET /_api/locations_search/

Basic examples

Search with geo query - search string

GET /_api/locations_search/?near_location=Seattle,%20WA

Search with geo postal code query

GET /_api/locations_search/?near_location=98121

Search with latitude/longitude coordinates

GET /_api/locations_search/?near_lat=39.8281&near_lon=-98.5795

Parameters

NameTypeDescription

near_location

string

Geographic search query. Can take any input that could be passed to Google Geocoding including city, state, full address or postal code

near_lat

float

Example: 39.8281

Used in combination with near_lon

near_lon

float

Example: -98.5795

Used in combination with near_lat

limit

integer

Number of locations to return

threshold

integer

Distance in distance_unit (miles/km) to restrict location search results

distance_unit

string

miles (default) or km

postal_code_match_type

string

Matching to location assigned postal code territories

Options: - only: This will only return locations that have postal codes assigned that match - first: This will return matching locations, but if no locations are assigned the postal code then normal geo-distance searched results will be returned

Response

Locations are returned within objects. If no locations are matched, objects will be an empty list.

For list of attributes returned for each location, see Location model

{
    "meta": {
        "total_count": 25
        ...
    },
    "objects": [
        {...Location object...},
        {...Location object...},
    ]
}

The response will also contain distance details for each location and distance context.

In the resulting response meta we will add the latitude and longitude of the searched point for reference.

{
    "meta": {
        "lat": 47.6062095,
        "lon": -122.3320708,
        ...
    }
}

In each of the the resulting Location objects, we add distance (in miles or km depending on distance_unit).

"objects": [{
    "id": 123456,
    "location_name": "Belltown",
    ...
    "distance": 996.79
}]

Additional examples

See if a postal code is assigned to any location

GET /_api/locations_search/?
    near_location=98121&
    postal_code_match_type=only&
    limit=1

Last updated