Location
- Since:
Members
-
readonly, nullable altitude :number
-
The altitude of the location in meters. Altitude is measured relative to the WGS84 reference ellipsoid. This value is
nullif the detected location doesn't have altitude.- Since:
-
readonly, nullable bearing :number
-
The bearing at the time of this location in degrees. Bearing is guaranteed to be in the range [0,360). This value is
nullif the detected location doesn't have bearing.- Since:
-
readonly, nullable bearingAccuracy :number
-
The bearing accuracy of this location in degrees. This value represents the estimated bearing accuracy in degrees of this location at the 68th percentile confidence level. This value is
nullif the detected location doesn't have bearing accuracy.- Since:
-
readonly hasFusedProvider :boolean
-
trueif the location was provided by Fused location provider andfalseotherwise.- Since:
-
readonly hasGpsProvider :boolean
-
trueif the location was provided by GPS andfalseotherwise.- Since:
-
readonly hasNetworkProvider :boolean
-
trueif the location was provided by Network andfalseotherwise.- Since:
-
readonly, nullable horizontalAccuracy :number
-
The horizontal accuracy of this location in meters. This value represents the estimated horizontal accuracy radius in meters of this location at the 68th percentile confidence level. This value is
nullif the detected location doesn't have horizontal accuracy. See also Location tutorial.- Since:
Example
mobicontrol.location.locate(onLocationEvent); function onLocationEvent(result) { if (result.isSuccessful && isWithinRange(result.location, 5)) { mobicontrol.log.info("There is at least a 68% chance the device is within 5 m of the meeting point."); } } function isWithinRange(location, maxAllowedDistance) { var meetingPoint = mobicontrol.location.createLocation(40.7575, -73.9858); return meetingPoint.distanceTo(location) + location.horizontalAccuracy < maxAllowedDistance; } -
readonly isMock :boolean
-
trueif the location is a mock location andfalseotherwise.- Since:
-
readonly latitude :number
-
The latitude of the location in degrees.
- Since:
-
readonly longitude :number
-
The longitude of the location in degrees.
- Since:
-
readonly, nullable speed :number
-
The speed at the time of this location in meters per second. This value is
nullif the detected location doesn't have speed.- Since:
-
readonly, nullable speedAccuracy :number
-
The speed accuracy of this location in meters per second. This value represents the estimated speed accuracy in meters per second of this location at the 68th percentile confidence level. This value is
nullif the detected location doesn't have speed accuracy.- Since:
-
readonly, nullable time :Date
-
The time of this location fix. This value is
nullif the location does not have a time.- Since:
-
readonly, nullable verticalAccuracy :number
-
The vertical (altitude) accuracy of this location in meters. This value represents the estimated vertical accuracy in meters of this location at the 68th percentile confidence level. This value is
nullif the detected location doesn't have vertical accuracy.- Since:
Methods
-
distanceTo(location) → {number}
-
Return the approximate distance in meters between this location and the given location. Distance is defined using the WGS84 ellipsoid. See also Location tutorial.
Parameters:
Name Type Description locationmobicontrol.location.Location The target location. Returns:
number - Distance in meters between this location and the given location.- Since:
-
isInside(geofence, accuracyopt) → {boolean}
-
Determine if it is highly probable that the location is inside the geofence. See also Location tutorial.
Parameters:
Name Type Attributes Description geofencemobicontrol.location.Geofence The geofence. accuracynumber <optional>
Accuracy in meters. If provided, it is used as a radius of the accuracy circle, instead of the mobicontrol.location.Location#horizontalAccuracy. Returns:
boolean -trueif there is at least a 68% chance that the location is inside the geofence andfalseotherwise.- Since:
Example
var createLocation = mobicontrol.location.createLocation; var colosseum = mobicontrol.location.createGeofence([ createLocation(41.890961, 12.491094), createLocation(41.890961, 12.493604), createLocation(41.889459, 12.493604), createLocation(41.889459, 12.491094) ]); mobicontrol.location.locate(onLocationEvent); function onLocationEvent(result) { if (result.isSuccessful) { if (result.location.isInside(colosseum)) { mobicontrol.log.info("Device is likely inside Colosseum"); } else if (result.location.isOutside(colosseum)) { mobicontrol.log.info("Device is likely outside Colosseum"); } else { mobicontrol.log.info("Device is in grey area"); } } } -
isOutside(geofence, accuracyopt) → {boolean}
-
Determine if it is highly probable that the location is outside the geofence. See also Location tutorial.
Parameters:
Name Type Attributes Description geofencemobicontrol.location.Geofence The geofence. accuracynumber <optional>
Accuracy in meters. If provided, it is used as a radius of the accuracy circle, instead of the mobicontrol.location.Location#horizontalAccuracy. Returns:
boolean -trueif there is at least a 68% chance that the location is outside the geofence andfalseotherwise.- Since:
-
toJSON() → {object}
-
Customize JSON stringification behavior. This function customizes behavior of
JSON.stringify(): instead of this Location being serialized, the object returned bytoJSON()will be serialized. Note: This function is intended to be called internally byJSON.stringify(); it is not intended to be called directly.
Check JSON Serialization tutorial for details.Returns:
object - Native JavaScript object representing this Location.- Since:
-
withHorizontalAccuracy(accuracy) → {mobicontrol.location.Location}
-
Set the horizontal accuracy of the location.
Parameters:
Name Type Description accuracynumber The horizontal accuracy in meters, see mobicontrol.location.Location#horizontalAccuracy. Returns:
mobicontrol.location.Location - This location.- Since: