Skip to content
EE Forge eeforge logo

Geolocation Documentation

Installation

Drop the geolocation folder into your /system/user/addons/ folder (or wherever you have your add-ons installed).

Navigate to your Extensions in the Control Panel and install it like any other add-on.


Settings

You'll need a Mapbox account with access to the Permanent Geocoding API (available by reaching out to Mapbox support).

Mapbox API Key

Enter your Mapbox account API key.

Country Restrictions

Setting a country restrictions will limit geocoding results to those countries selected.  It is recommended to set this to limit results to those that are relevant.

Types

Setting the types returned will determine the level of "specificity" returned in geocoded results.

Enter map center

Set the center of your starting map in the control panel.  By default this is set to the center of the US but you could/should update this to a realistic center point for your usage.  Doing so will decrease the mapping API calls and data usage in the control panel.


Fieldtype Usage

From the control panel Publish tab use the map search and begin typing the address.  Select the correct result from the live drop-down and the components will populate on the side.  The components can be manually edited if you desire.


Template Tags

Template tags can be either tag pairs or single tags. The field name is always used as a prefix to avoid naming collisions.

{field_name}
    {field_name:postcode}
    {field_name:country}
    ....
{/field_name}

Any template variable can also be used as a single tag.  If only the field name is used (with no suffix) then the formatted address will be displayed.

{field_name:postcode}

Template Variables

The following variables are available for the fieldtype.

lat

{field_name:lat}

Displays the latitude coordinate component.

lng

{field_name:lng}

Displays the longitude coordinate component.

formatted_address

{field_name}
{field_name:formatted_address}

Outputs the fully formatted address component.

address

{field_name:address}

Displays the address component.

place

{field_name:place}

Displays the place/city component.

district

{field_name:district}

Displays the district/county component.

region

{field_name:region}

Displays the region/state/province component.

state

{field_name:state}

This is the same as region but implemented for ease.

province

{field_name:province}

This is the same as region but implemented for ease.

postcode

{field_name:postcode}

Displays the postal code component.

country

{field_name:country}

Displays the country component.