1.4.0releasedAddress Location Field

Geocode an address, then refine the latlng returned for precision.

Clone URLhttps://github.com/designermonkey/addresslocationfield.git

Add as a submodulegit submodule add https://github.com/designermonkey/addresslocationfield.git extensions/addresslocationfield --recursive

Compatibility

2.x.x2.1.x2.2.x2.3.x2.4.x2.5.x2.6.x2.7.02.7.12.7.22.7.32.7.42.7.52.7.62.7.72.7.82.7.92.7.10
NoNo11.4.01.4.01.4.01.4.01.4.01.4.01.4.01.4.01.4.01.4.01.4.01.4.01.4.01.4.01.4.0

Readme

Address Location Field

Easier address input

Installation

  1. Upload the 'addressgeolocationfield' folder in this archive to your Symphony 'extensions' folder
  2. Enable it by selecting the "Field: Address GeoLocation", choose Enable from the with-selected menu, then click Apply
  3. The field will be available in the list when creating a Section

Configuration

Important! Browser API key is now required

Simply go in your configuration and add the following line : 'addresslocationfield' => array('api_key' => 'Browser API key'),

Replace the Browser API key by the one generated by Google API

When adding this field to a section, the following options are available to you:

  • Address Field's Labels can be changed to whatever you prefer

The field works in both Main Content and Sidebar columns, collapsing to a smaller viewport if required in the sidebar.

Usage

When creating a new entry, add the address details into the fields provided. Once added, click on 'Locate on map' to find a latitude and longitude, and displaying the marker on the map.

The marker can be dragged around the map to more precisely locate your latitude and longitude, which will be stored in the fields.

To start again with a new address, click on the 'Clear Address' button.

Data Source Filtering

Address Fields's filtering syntax hopefully compliments Symphony's built-in syntax. There are two types of queries: 1) Queries on sub-fields and 2) radius queries.

Sub-field queries:

in SUBFIELD of VALUE
  • SUBFIELD corresponds to the label of the sub-field on the field. For instance, if you changed the Postal Code to 'Zip code' this would be zip-code.
  • VALUE is the value you are matching.

Examples:

in city of springfield
in postal-code of {$postal}
in state of {$state}

Radius queries:

within DISTANCE UNIT of ORIGIN
  • DISTANCE is an number
  • UNIT is the distance unit: km, mile or miles
  • ORIGIN is the longitude and latitude, separated by a comma ','

Examples:

within 5 miles of -93.2971954;37.2083092
within 100 km of {$coords}
within {$distance} of {$longitude},{$latitude}

Data Source XML Result

<address longitude="-93.2971954" latitude="37.2083092">
    <street handle="600-w-college">600 W College</street>
    <city handle="springfield">Springfield</city>
    <state handle="missouri">Missouri</state>
    <zip-code handle="65806">65806</zip-code>
    <country handle="united-states-of-america">United States of America</country>
</address>

The first two attributes are the latitude/longitude of the marker on the map. The <map> element contains any information you need to rebuild the Google Map on the frontend of your website: its zoom level, and centre-point.

If you are filtering using the Address GeoLocation Field using a "within" filter then you will see an additional <distance> element:

<location latitude="51.6614" longitude="-0.40042">
    <distance from="51.6245572,-0.4674079" distance="3.8" unit="miles" />
</location>

The from attribute is the latitude/longitude resolved from the DS filter (the origin), the unit shows either "km" or "miles" depending on what you use in your filter, and distance is the distance between your map marker and the origin.

Version history

Symphony 2.3 to 2.7.x

  • Add preferences UI (#22)

Symphony 2.3 to 2.6.x

  • Supported on PHP 7
  • Removed sensor
  • Added a config entr to Google API key (must be set via config.php)
  • Fixes on database update and params to fit the parent method

Requires Symphony 2.3

  • Allow null for result_data

Requires Symphony 2.3

  • Store entire Google Maps geocode result

Requires Symphony 2.3

  • Fixed Issue #4, https://github.com/designermonkey/addresslocationfield/issues/4

Requires Symphony 2.3

  • 2.3 compatibility.

Symphony 2.2 to 2.2.5