HomeGuidesRecipesAPI
HomeGuidesAPILog In

Geolocation

The Geolocation question type is for getting the latitude and longitude of the current user, typically using a mobile device out in the field.

This question has only one additional property called “High accuracy” that is available under Properties tab. If this is on then the GPS will be used in the device if available.

If "High accuracy" is off or there is no GPS available then mobile tower triangulation, or IP address known locations, will be used. This depends on the browser’s logic and is in order of accuracy.

📘

IP addresses will mostly just return the center of the town the user is in

Usage

Geolocation answer has a property called Field which selects which part of the coordinates you want. This property comes with three options "Latitude, Longitude", "Latitude" or "Longitude". The first option ("Latitude, Longitude") is the standard notation for coordinates. It can be passed directly to other systems like Google maps and will always be in the format "0.0,0.0".

Web App

Question displays as two text boxes for latitude and longitude which can be user entered numbers (mainly if you had an external GPS device).

There is also a button called Use current location that will capture the current user’s location.

📘

Due to browser security limitations, automatic geolocation is unavailable if the site is not secured by HTTPS. On unsecured sites the location can be entered manually.

Offline App

In the offline app, the Geolocation question will display as a static map.

The map view is call from Google's Static Maps web service and for reliable display requires an API Key. For further information on how to generate a suitable key see: https://developers.google.com/maps/documentation/maps-static/intro

To register the key with SmartIQ you need to add or edit the option below in the Global_Options table in your SmartIQ database for the relevant BusinessUnitGuid. Set the OptionValue to the key you have generated.

GOOGLE_MAPS_STATIC_API_KEY