Google Widgets
Use the Google Widgets extension package provided by ThingWorx to select and plot geographical locations on a map within ThingWorx. The extension package consists of two main widgets: the Google Location Picker widget and the Google Map widget. Google Maps is a web mapping service application and technology provided by Google. The location picker can be used in a mashup to set a location on a Google map.
To use Google Maps, you must obtain a license. For more information, review Google Maps Usage Limits and Billing.
The Google Widgets extension 3.0.4 and later versions come with security enhancements.
To use the Google widgets extension package, download and import the GoogleWidgets_ExtensionPackage.zip
into ThingWorx. The package imports the following into ThingWorx:
- Google Location Picker widget
- Google Map widget
- DefaultMapRegionSelectedStyle style definition (default map region selected style.)
For information about the Google Location Picker widget and its properties, see Google Location Picker.
For information about the Google Map widget and its properties, see Google Map.
Using the Google Widgets 3.0.2 and Later Versions
The Google Widgets 3.0.2 and later versions are compatible only with ThingWorx Platform 8.2.8+ and 8.3.3+ versions.
To use Google widgets in ThingWorx, you must get and implement your own Google Maps API key or Client ID (for the Google Maps API for Work licenses). Refer to either Google Maps API documentation or Client ID Information to obtain an API key or Client ID.
Refer to the section Upgrading from v2 to v3 to understand the updates to the API key made by Google. If you use the old URL https://maps.google.com/maps/api/js?sensor=false&key=YOUR_API_KEY
or v2 of the API key , an error “FOR DEVELOPMENT PURPOSE ONLY” message appears. You must then regenerate the API key.
For more information about managing APIs, refer to Managing APIs.
After you obtain an API key or Client ID, follow the steps below:
-
Download the Google Widgets extension into a folder.
-
In the ThingWorx Composer, navigate to Subsystem > PlatformSubsystem > Services.
- Search and locate GetGoogleMapConnectionString and SetGoogleMapConnectionString.
You can select the GetGoogleMapConnectionString and click Execute to verify the connection string.
-
Select the SetGoogleMapConnectionString and enter the URL that includes your API key in the field.
-
Click Save Input Set and then click Execute.
- Import the extension into ThingWorx and start using the Google widgets in your mashup.
Using the Google Widgets 3.0.1 and Earlier Versions
It is recommended to upgrade to the latest version of the Google Widgets extension package.
To use Google widgets in ThingWorx, you must get and implement your own Google Maps API key or Client ID (for the Google Maps API for Work licenses). Refer to either Google Maps API documentation or Client ID Information to obtain an API key or Client ID.
Refer to the section Upgrading from v2 to v3 to understand the updates to the API key made by Google. If you use the old URL https://maps.google.com/maps/api/js?sensor=false&key=YOUR_API_KEY
or v2 of the API key , an error “FOR DEVELOPMENT PURPOSE ONLY” message appears. You must then regenerate the API key.
For more information about managing APIs, refer to Managing APIs.
After you obtain an API key or Client ID, follow the steps below:
-
Extract the Google Widgets extension into a folder.
-
Under the googlemap widget entry in the metadata.xml file, update the Google API URL to include your API key or Client ID. The updated URL should appear similar to one of the following:
https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY
- Google Maps API for Work licenses:
<script src="https://maps.googleapis.com/maps/api/js?client=YOUR_CLIENT_ID&v=3.21"</script>
-
Zip the extension and import it into ThingWorx.