Google Maps & Street View Open
Google Street View provides panoramic views from positions along many streets in the world. This example assumes you have a Hyperlink field with a data name of show_street_view
and shows how you can script a click event to directly open Street View at your record location when the button is tapped. NOTE: This data event will only apply when the geometry type of a record is set to Point
. Unless you have enabled Lines and Polygons for your app, the Point
type will be the only available geometry type for records in this app.
ON('click', 'show_street_view', function (event) {
if (LATITUDE() && LONGITUDE()) {
OPENURL('https://maps.google.com/maps?layer=c&cbll=' + LATITUDE() + ',' + LONGITUDE());
} else {
ALERT('No location provided!', 'A location is required to show Street View.')
}
});
Note that the Google Maps app must be installed for this to work on mobile.
Alternatively if you would like to use regular Google Maps for routing to a record location, this example can be used with a Hyperlink field having a data name open_google_maps
and uses a click event to directly open the Google Maps app at your record location when the button is tapped.
ON('click', 'open_google_maps', function (event) {
if (LATITUDE() && LONGITUDE()) {
OPENURL('https://maps.google.com/?q=' + LATITUDE() + ',' + LONGITUDE());
} else {
ALERT('No location provided!', 'A location is required to show Google Maps.')
}
});
NOTE: The LATITUDE and LONGITUDE functions will only return values if a record's geometry type is set to Point
, and there is a location set. Unless you have enabled Lines and Polygons for your app, the Point
type will be the only available geometry type for records in the app.
Updated 12 months ago