Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

ezgmaplocation: a map location datatype

This page is for site builders who store places on content, such as offices, events or users. ezgmaplocation is a datatype that stores a latitude and longitude (decimal degrees) on an object. The editor finds the point…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/features/6.0/extensions/ezgmaplocation.md

On this page

ezgmaplocation: a map location datatype

This page is for site builders who store places on content, such as offices, events or users. ezgmaplocation is a datatype that stores a latitude and longitude (decimal degrees) on an object. The editor finds the point by typing an address under a Google map. The address is stored with the coordinates and is searchable.

Set it up

  1. Get a Google Maps JavaScript API key and set it in ezgmaplocation.ini [GMapSettings] ApiKey=<key> (in settings/override/ or per siteaccess). With an empty key the edit form and the view load no Google script and show the coordinates without a map; a site that sends a Content Security Policy has to allow Google's hosts.
  2. Activate the extension and regenerate the extension autoloads: php bin/php/ezpgenerateautoloads.php -e.
  3. Create the table ezgmaplocation from extension/ezgmaplocation/sql/<engine>/ (a SQLite schema ships since 6.0.3).
  4. Add the Google Maps Location datatype to a class.

Edit a location

  1. Type an address under the map and press Find address: the map centers on it and the latitude and longitude fields are filled in.
  2. Refine by dragging the marker or clicking the map; the coordinates follow, and the address field is cleared. Restore brings back the location stored before, and My current location uses the browser's position.

Example: find objects close to a point

The included filter fetches by distance, sorted by closeness:

{def $users_close_by = fetch( 'content', 'tree', hash(
        'parent_node_id', 12,
        'limit', 3,
        'sort_by', array( 'distance', true() ),
        'class_filter_type', 'include',
        'class_filter_array', array( 'user' ),
        'extended_attribute_filter', hash( 'id', 'ezgmlLocationFilter',
                                           'params', hash( 'latitude', 59.917,
                                                           'longitude', 10.729,
                                                           'distance', 0.5 ) ) ) )}

Limits

  • The distance filter uses a bounding box for SQL speed. classes/ezgmllocationfilter.php documents the parameters that give true "arccosine" or closer-to-true "pythagorean" circular accuracy. The sort is accurate.
  • To show the distance ("2.5 km away"), use the arccosine parameter with as_object, false() to get a value from which to compute it.

What changed in the Exponential 6 releases

VersionChange
6.0.2Latitude and longitude normalisation works with the stricter implode() handling of PHP 8.5.
6.0.3SQLite schema for the location table; ezinfo.php states version, license and website.
6.0.4Every visible text is a translation string with German; the two JavaScript alerts come from translated messages with placeholders.
6.0.5, 6.0.6The description names Exponential; copyright notices name 1998 - 2026 7x & Exponential Foundation first.

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x