Adding a Google Maps API Key to your PxPlus Google Maps Interface

Started by Jane Raymond, November 02, 2018, 03:14:41 PM

Previous topic - Next topic

Jane Raymond

As of July 2018, if you are not a client of the Google Maps APIs Premium Plan, Google requires you to have a Google Maps API Key to do development using the Google Maps APIs. Without an API Key, the maps and their features are still functional, but the map display is darkened and displays a "For development purposes only" watermark. Also, a "This page can't load Google Maps correctly" message box is displayed. To display the maps cleanly, you must obtain an API Key from Google, and apply that key when using the PxPlus Google Maps interface.


For information about obtaining a Google Maps API Key, go here:
https://developers.google.com/maps/documentation/javascript/get-api-key
(Be sure to activate it for Maps and Routes.)


Once you have a key, you must apply it to the PxPlus Google Map interface. As of PxPlus 2018 Update 1, the PxPlus Google.Maps object has an APIkey$ property which you can set to do this. This can be set in one of two ways:

       
  • Set the APIkey$ property in the NOMADS map definition in the COM Control Properties interface. The API Key for each client will be different, so an expression would most likely be used to supply the value for the APIkey$ property.  This would have to be done for each map definition.
  • Leave the APIkey$ property blank in the map definition and simply load the %GoogleAPIkey$ variable with the API Key value prior to displaying any maps (such as in the START_UP program). The PxPlus Google.Maps object will retrieve the key value from this variable and set the APIkey$ property automatically without having to change any definitions or code.
Your maps should display cleanly once the API Key is in place.
Jane Raymond
Software Developer
PVX Plus Technologies Ltd.