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
- Get a Google Maps JavaScript API key and set it in
ezgmaplocation.ini [GMapSettings] ApiKey=<key>(insettings/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. - Activate the extension and regenerate the extension autoloads:
php bin/php/ezpgenerateautoloads.php -e. - Create the table
ezgmaplocationfromextension/ezgmaplocation/sql/<engine>/(a SQLite schema ships since 6.0.3). - Add the Google Maps Location datatype to a class.
Edit a location
- Type an address under the map and press Find address: the map centers on it and the latitude and longitude fields are filled in.
- 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.phpdocuments 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
arccosineparameter withas_object,false()to get a value from which to compute it.
What changed in the Exponential 6 releases
| Version | Change |
|---|---|
| 6.0.2 | Latitude and longitude normalisation works with the stricter implode() handling of PHP 8.5. |
| 6.0.3 | SQLite schema for the location table; ezinfo.php states version, license and website. |
| 6.0.4 | Every visible text is a translation string with German; the two JavaScript alerts come from translated messages with placeholders. |
| 6.0.5, 6.0.6 | The description names Exponential; copyright notices name 1998 - 2026 7x & Exponential Foundation first. |
Related pages
- Extension metadata specification
- Chronicle and release notes
- Change ledger
- Behaviour changes of the extensions
- Months: 2026-04, 2026-09 (all extensions)
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.