Map locations with ezgmaplocation
This page is for administrators and site builders. ezgmaplocation is a datatype that stores a latitude and
longitude (decimal degrees) and an address on an object; editors find the point by typing an address under a Google
map (ezgmaplocation).
Contents
- Before you start
- Activate and create the table
- The API key
- Content Security Policy
- Add the field to a class
- Upgrading from 6.0.7 or earlier
Before you start
Read "Maps and privacy": with a key, the edit form and the page load Google's script, which is a third party.
Activate and create the table
- Activate the extension (Setup > Extensions, or
ActiveExtensions[]) and regenerate the extension autoloads:php bin/php/ezpgenerateautoloads.php -e. - Create the table
ezgmaplocationfromextension/ezgmaplocation/sql/<engine>/(mysql,postgresql,oracle,sqlite); ashare/db_schema.dbaships too.
The API key
The extension's README (the current source) says: add your Google Maps JavaScript API key to ezgmaplocation.ini [GMapSettings] ApiKey in settings/override/ezgmaplocation.ini.append.php, or per siteaccess. The old site.ini [SiteSettings] GMapsKey is not read any more (the 6.0 feature page still names it). Without a key the edit form and
the view load no Google script and show the coordinates without a map.
Content Security Policy
A site or administration that sends a Content Security Policy (site.ini [ContentSecurityPolicy]) must allow
Google's hosts; the README lists the AdditionalSources[] lines for script-src, img-src, connect-src,
font-src, style-src, frame-src and worker-src. Without a key nothing has to be allowed
(Content Security Policy).
Add the field to a class
- Setup > Classes, the class (for example "Service point"), Edit.
- Under Add attribute choose GMap Location, press Add, name it "Location", identifier
location. - OK.
Editors then type an address and press Find address; the map moves the marker there and fills the Latitude
and Longitude fields, which a click on the map or dragging the marker also update. Restore returns to the
values the page was opened with. (The README and the 6.0 feature page still name an "Update Values" button; the
current edit template, design/standard/templates/content/datatype/edit/ezgmaplocation.tpl, has none.) The
address is searchable.
Upgrading from 6.0.7 or earlier
Earlier versions stored the address with HTML entities. The README asks to decode the stored rows once per
database before editors work with the new version: php extension/ezgmaplocation/bin/php/decodeaddressentities.php -s <siteaccess> (a dry run that lists the rows), then the same with --apply. Run it once only.
Related pages
- What exists for maps
- Adding a service point location
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
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.