When an instance is configured to use an API Map key instead of a Client ID for Google Maps functionality, Google Map functions work within the instance except for the Geocoding Latitude and Longitude functionality which fails. This is because the Google request to obtain the Latitude and Longitude only caters for a Client ID and not API Map Key. 

To enable Latitude and Longitude functionality in the instance:

  • Configure the "Table used by the map" in System Properties > Googel Maps: /system_properties_ui.do?sysparm_title=Google%20Maps%20Properties&sysparm_category=Google%20Maps
    • NOTE: The default value is "cmn_location"
  • Enable the associated "get_lat_long" business rule.
  • Enable the scheduled job "Process Geocoding Request"
  • Go the location table (cmn_location)
  • Update an address of a location record (Street or City or State or ZIP or Country)
  • System logs will show the following error when attempting to update Latitude and Longitude.

*** Script [GoogleMapsHelper.google_getLatLong]: Unknown response: Unable to authenticate the request. Provided 'signature' is not valid for the provided client ID, or the provided 'client' is not valid.


Google have changed their model where Client ID is only available for old Google Maps business plan holders and new Premium Plan holders (Client ID's start with "gme-"). Any new Google plan holder will likely use the API Map Key as Client ID is not available. 

The Geocoding Latitude and Longitude functionality fails within the instance because the Google request to obtain the Latitude and Longitude only caters for the Client ID and not API Map Key.


The Script Include "GoogleMapsHelper" and function "google_get_LatLong" constructs the URL request made to Google to obtain the Latitude and Longitude of the address.  

var geo_auto = "google.maps.geocoding.automation";

var gl = new GSLog("google.maps.logging", "GoogleMapsHelper.google_getLatLong");
var url = "https://maps.googleapis.com/maps/api/geocode/json";
var query = "address=" + addr + "&sensor=false&client=" + gs.getProperty("google.maps.client");
var parms = new String(query).replaceAll(" ", "+");
var url_to_sign = "/maps/api/geocode/json?" + parms;

gl.logDebug("signing url: " + url_to_sign);
var signature = GoogleMaps.generateSignature(url_to_sign);
gl.logDebug("signature: " + signature);

parms += "&signature=" + signature;

The construction of the request URL is only for Client ID and doesn't cater for the API Map Key.

https://maps.googleapis.com/maps/api/geocode/json?address=<ADDRESS>&sensor=false&client=<CLIENT ID>&signature=<SIGNATURE>

The URL to make a request to Google using the API Map Key is:

https://maps.googleapis.com/maps/api/geocode/json?address=<ADDRESS>&sensor=false&key=<API Key>

For API Map Keys to work, update the following lines in the "GoogleMapsHelper" script include (line numbers are apporximate and may differ in your release):

  • Line: 17
    • Change: var query = "address=" + addr + "&sensor=false&client=" + gs.getProperty("google.maps.client");
    • To: var query = "address=" + addr + "&sensor=false&key=" + gs.getProperty("google.maps.key");
  • Line: 26
    • Change: parms += "&signature=" + signature;
    • To: //parms += "&signature=" + signature;

This will now use the API Map Key for geocoding requests.


Additional Information

Map Pages [Madrid]

Article Information

Last Updated:2019-09-11 04:56:23