πŸ”§ Front-End Address Lookup

How to update from Smart Map to Google Maps

Follow the instructions below to learn how to update to the new Google Maps plugin...

Under the hood, the entire concept of geocoding has evolved significantly. Fortunately, the required templating changes are minimal.

{# OLD METHODS #}
{% set results = craft.smartMap.lookup(target) %} {# became "all" #}
{% set coords  = craft.smartMap.lookupCoords(target) %}
{# NEW METHODS #}
{% set results = googleMaps.lookup(target).all() %}
{% set address = googleMaps.lookup(target).one() %}
{% set coords  = googleMaps.lookup(target).coords() %}

The general syntax has changed slightly. The lookup method now creates a Lookup Model, which doesn't actually ping the API until you apply a subsequent method (all, one, or coords).

New Documentation

See the complete new Geocoding Methods documentation.

# Lookup via AJAX

The premise is effectively the same, but the POST endpoints have changed:

// OLD ENDPOINTS
var endpoint = '/actions/smart-map/lookup'; // became "all"
var endpoint = '/actions/smart-map/lookup/coords';
// NEW ENDPOINTS
var endpoint = '/actions/google-maps/lookup/all';
var endpoint = '/actions/google-maps/lookup/one';
var endpoint = '/actions/google-maps/lookup/coords';

New Documentation

See the complete new Geocoding via AJAX documentation.