Lookup Model

When a Lookup Model is initialized, it should be passed a collection of parameters which specify the lookup details. These parameters will be stored internally once the object is created.

{# Configure Lookup Model #}
{% set lookup = googleMaps.lookup(target) %}

{# Perform the geocoding lookup #}
{% set results = lookup.all() %}

Once you apply the all (or one, or coords) method, those parameters will be used to ping the Google Geocoding API (opens new window). The results of each lookup will be cached for 30 days, in order to ease the load on the API.

For more information, see the Geocoding Methods page.

# Public Properties

# error

string - If an error occurred during the lookup process, it will be set here.

# Public Methods

# all()

Perform lookup and return complete results. Addresses will be sorted by best match.

Returns

Address[] - An array of Address Models, or null if nothing was found.

# one()

Perform lookup and return only the first matching result. Generally speaking, the first address is typically the best match.

Returns

Address - A single Address Model, or null if nothing was found.

# coords()

Perform lookup and return only the coordinates of the first matching result.

Returns

coords - A coords object, or null if nothing was found.