Geolocation Field

Component ID

241478

Component name

Geolocation Field

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

235131

Component created

Component changed

Component body

Geolocation Field provides a field type to store geographical locations as pairs of latitude and longitude (lan,lng). The Drupal 8 version also provides a views proximity search plugin. Geolocation Field can be used with all fieldable entities like nodes, users, comments, taxonomy terms, etc.

Geolocation Field aims to provide a light-weight, easy-to-use and robust alternative to more complex solutions.

Google Maps example

Drupal 8

The Drupal 8 version of Geolocation Field is a complete rewrite. Please test and open an issue to fix a bug or share your thoughts.

Support

If you need paid support beyond the issue queue, you can drop a message to the main D8 developer

Demo

https://simplytest.me/project/geolocation/8.x-1.x - Click "Launch sandbox" & install & enable "Geolocation Demo" module

Features

Field
  • field storage of lat,lng pairs
  • basic lat,lng text input widget
  • basic lat,lng formatter with microdata output (rich snippet: twig template).
  • HTML5GeolocationWidget
  • GoogleGeocodingWidget
  • configurable Google Maps formatter
Views
  • proximity field
  • proximity filter
  • boundary filter
  • proximity sort
  • CommonMap views style - display multiple results on the same map
  • Ajax Views support - AirBnB like formatter
General
  • Lots of tests

Modules

Integrated sub-modules
  • Google Places API geocoding support
  • Geolocation Demo - views and feature demos
Separate modules

Drupal 7

  • Plain text (input & output)
  • Google Maps (input & output)
  • Geolocation HTML5 (input & output)
  • Geolocation Proximity for proximity/distance based view results.
  • 7.x-1.x-dev Google Maps Geocoder (backport of Drupal 8 version)
  • 7.x-1.x-dev Template based microdata formatter (backport of Drupal 8 version)

Technical background (Drupal 7/Drupal 8)

At the moment Geolocation stores the following values in the database:

  • lat (latitude),
  • lng (longitude),
  • lat_sin (precalculated latitude sine),
  • lat_cos (precalculated latitude cosine),
  • lng_rad (precalculated radian longitude).

The precalculated values will speed up proximity SQL look ups.