VerticalAccuracy Property

Applies to TestComplete 14.70, last modified on April 22, 2021

Description

Returns the estimated vertical accuracy of the current location, in meters.

Declaration

iOSGPSDataObj.VerticalAccuracy

Read-Only Property Double
iOSGPSDataObj An expression, variable or parameter that specifies a reference to an iOSGPSData object

Applies To

The property is applied to the following object:

Property Value

The estimated vertical accuracy of the current location, in meters.

Remarks

If the altitude is not determined, the property returns 0.

VerticalAccuracy does not relate to the latitude and longitude values.

Example

The code below retrieves location data from the iOS device's GPS sensor, posts them to the test log and shows the location in Google Maps:

JavaScript, JScript

function PostGPSLocation()
{
  Mobile.SetCurrent("iPad");
  // Check whether GPS is enabled
  if (Mobile.Device().GPS.GPSEnabled)
  {
    // Obtain location data
    var Longt = Mobile.Device().GPS.Location.Longitude;
    var Lat = Mobile.Device().GPS.Location.Latitude;
    // Output the location data
    Log.Message("The device location is:");
    Log.Message("Longitude: "+ aqConvert.VarToStr(Longt));
    Log.Message("Latitude: "+ aqConvert.VarToStr(Lat));
    Log.Message("Altitude: "+ aqConvert.VarToStr(Mobile.Device().GPS.Location.Altitude));
    Log.Message("VerticalAccuracy: "+ aqConvert.VarToStr(Mobile.Device().GPS.Location.VerticalAccuracy));
    Log.Message("HorizontalAccuracy: "+ aqConvert.VarToStr(Mobile.Device().GPS.Location.orizontalAccuracy));
    Log.Message("Course: " + aqConvert.VarToStr(Mobile.Device().GPS.Location.Course));
    Log.Message("Speed: " + aqConvert.VarToStr(Mobile.Device().GPS.Location.Speed));
    // Open Google Maps in the browser and pass the coordinates as URL parameters
    Browsers.Item(Browsers.btIExplorer).Run("http://maps.google.com/maps?q=loc:" + aqConvert.VarToStr(Lat) + "," + aqConvert.VarToStr(Longt));
  }
}

Python

def PostGPSLocation():
  Mobile.SetCurrent("iPad")
  # Check whether GPS is enabled
  if Mobile.Device().GPS.GPSEnabled:
    # Obtain location data
    Longt = Mobile.Device().GPS.Location.Longitude
    Lat = Mobile.Device().GPS.Location.Latitude
    # Output the location data
    Log.Message("The device location is:")
    Log.Message("Longitude: " + aqConvert.VarToStr(Longt))
    Log.Message("Latitude: " + aqConvert.VarToStr(Lat))
    Log.Message("Altitude: " + aqConvert.VarToStr(Mobile.Device().GPS.Location.Altitude))
    Log.Message("VerticalAccuracy: " + aqConvert.VarToStr(Mobile.Device().GPS.Location.VerticalAccuracy))
    Log.Message("HorizontalAccuracy: " + aqConvert.VarToStr(Mobile.Device().GPS.Location.HorizontalAccuracy))
    Log.Message("Course: " + aqConvert.VarToStr(Mobile.Device().GPS.Location.Course))
    Log.Message("Speed: " + aqConvert.VarToStr(Mobile.Device().GPS.Location.Speed))
    # Open Google Maps in the browser and pass the coordinates as URL parameters
    Browsers.Item[Browsers.btIExplorer].Run("http://maps.google.com/maps?q=loc:" + aqConvert.VarToStr(Lat) + "," + aqConvert.VarToStr(Longt))

VBScript

Sub PostGPSLocation
  Call Mobile.SetCurrent("iPad")
  ' Check whether GPS is enabled
  If Mobile.Device.GPS.GPSEnabled Then
    ' Obtain location data
    Longt = Mobile.Device.GPS.Location.longitude
    Lat = Mobile.Device.GPS.Location.latitude
    ' Output the location data
    Call Log.Message("The device location is:")
    Call Log.Message("Longitude: "& aqConvert.VarToStr(Longt))
    Call Log.Message("Latitude: "& aqConvert.VarToStr(Lat))
    Call Log.Message("Altitude: "& aqConvert.VarToStr(Mobile.Device.GPS.Location.Altitude))
    Call Log.Message("VerticalAccuracy: "& aqConvert.VarToStr(Mobile.Device.GPS.Location.VerticalAccuracy))
    Call Log.Message("HorizontalAccuracy: "& aqConvert.VarToStr(Mobile.Device.GPS.Location.HorizontalAccuracy))
    Call Log.Message("Course: "& aqConvert.VarToStr(Mobile.Device.GPS.Location.Course))
    Call Log.Message("Speed: "& aqConvert.VarToStr(Mobile.Device.GPS.Location.Speed))
    ' Open Google Maps in the browser and pass the coordinates as URL parameters
    Call Browsers.Item(Browsers.btIExplorer).Run("http://maps.google.com/maps?q=loc:" & aqConvert.VarToStr(Lat) & "," & aqConvert.VarToStr(Longt))
  End If
End Sub

DelphiScript

procedure PostGPSLocation;
var Longt, Lat;
begin
  Mobile.SetCurrent('iPad');
  // Check whether GPS is enabled
  if Mobile.Device.GPS.GPSEnabled then
  begin
    // Obtain location data
    Longt := Mobile.Device.GPS.Location.Longitude;
    Lat := Mobile.Device.GPS.Location.Latitude;
    // Output the location data
    Log.Message('The device location is:');
    Log.Message('Longitude: ' + aqConvert.VarToStr(Longt));
    Log.Message('Latitude: ' + aqConvert.VarToStr(Lat));
    Log.Message('Altitude: ' + aqConvert.VarToStr(Mobile.Device.GPS.Location.Altitude));
    Log.Message('VerticalAccuracy: ' + aqConvert.VarToStr(Mobile.Device.GPS.Location.VerticalAccuracy));
    Log.Message('HorizontalAccuracy: ' + aqConvert.VarToStr(Mobile.Device.GPS.Location.HorizontalAccuracy));
    Log.Message('Course: ' + aqConvert.VarToStr(Mobile.Device.GPS.Location.Course));
    Log.Message('Speed: ' + aqConvert.VarToStr(Mobile.Device.GPS.Location.Speed));
    // Open Google Maps in the browser and pass the coordinates as URL parameters
    Browsers.Item(Browsers.btIExplorer).Run('http://maps.google.com/maps?q=loc:' + aqConvert.VarToStr(Lat) + ',' + aqConvert.VarToStr(Longt));
  end;
end;

C++Script, C#Script

function PostGPSLocation()
{
  Mobile["SetCurrent"]("iPad");
  // Check whether GPS is enabled
  if (Mobile["Device"]["GPS"]["GPSEnabled"])
  {
    // Obtain location data
    var Longt = Mobile["Device"]["GPS"]["Location"]["Longitude"];
    var Lat = Mobile["Device"]["GPS"]["Location"]["Latitude"];
    // Output the location data
    Log["Message"]("The device location is:");
    Log["Message"]("Longitude: " + aqConvert["VarToStr"](Longt));
    Log["Message"]("Latitude: " + aqConvert["VarToStr"](Lat));
    Log["Message"]("Altitude: " + aqConvert["VarToStr"](Mobile["Device"]["GPS"]["Location"]["Altitude"]));
    Log["Message"]("VerticalAccuracy: " + aqConvert["VarToStr"](Mobile["Device"]["GPS"]["Location"]["VerticalAccuracy"]));
    Log["Message"]("HorizontalAccuracy: " + aqConvert["VarToStr"](Mobile["Device"]["GPS"]["Location"]["HorizontalAccuracy"]));
    Log["Message"]("Course: " + aqConvert["VarToStr"](Mobile["Device"]["GPS"]["Location"]["Course"]));
    Log["Message"]("Speed: " + aqConvert["VarToStr"](Mobile["Device"]["GPS"]["Location"]["Speed"]));
    // Open Google Maps in the browser and pass the coordinates as URL parameters
    Browsers["Item"](Browsers["btIExplorer"])["Run"]("http://maps.google.com/maps?q=loc:" + aqConvert["VarToStr"](Lat) + "," + aqConvert["VarToStr"](Longt));
  }
}

See Also

Geolocation Testing
iOSGPSData Object

Highlight search results