Class Location

Definition

Namespace:
Tizen.Location
Assembly:
Tizen.Location.dll
API Level:
3

This class contains details of the location requested. Includes the functionality to get the distance between locations.

C#
Copy
public class Location
Inheritance
Location

Constructors

View Source

Location()

The default constructor of the Location class.

Declaration
C#
Copy
public Location()
API Level: 3
View Source

Location(Double, Double, Double, Double, Double, Double, Int32)

The parameterized constructor of the Location class.

Declaration
C#
Copy
public Location(double latitude, double longitude, double altitude, double speed, double direction, double accuracy, int timestamp)
Parameters
Type Name Description
System.Double latitude

The latitude component of the device co-ordinate [-90.0 ~ 90.0] (degrees).

System.Double longitude

The longitude component of the device co-ordinate[-180.0 ~ 180.0] (degrees).

System.Double altitude

The altitude value.

System.Double speed

The device speed.

System.Double direction

The device direction with respect to the north.

System.Double accuracy

The accuracy in meters.

System.Int32 timestamp

Time when the measurement took place.

Exceptions
Type Condition
System.ArgumentException

Thrown when an invalid argument is used.

API Level: 3

Properties

View Source

Accuracy

The accuracy.

Declaration
C#
Copy
public double Accuracy { get; set; }
Property Value
Type Description
System.Double
API Level: 3
View Source

Altitude

The current altitude (meters).

Declaration
C#
Copy
public double Altitude { get; set; }
Property Value
Type Description
System.Double
API Level: 3
View Source

Direction

The direction and degrees from the north.

Declaration
C#
Copy
public double Direction { get; set; }
Property Value
Type Description
System.Double
API Level: 3
View Source

Latitude

The current latitude [-90.0 ~ 90.0] (degrees).

Declaration
C#
Copy
public double Latitude { get; set; }
Property Value
Type Description
System.Double
API Level: 3
View Source

Longitude

The current longitude [-180.0 ~ 180.0] (degrees).

Declaration
C#
Copy
public double Longitude { get; set; }
Property Value
Type Description
System.Double
API Level: 3
View Source

Speed

The device speed (km/h).

Declaration
C#
Copy
public double Speed { get; set; }
Property Value
Type Description
System.Double
API Level: 3
View Source

Timestamp

The time value when the measurement was done.

Declaration
C#
Copy
public DateTime Timestamp { get; }
Property Value
Type Description
System.DateTime
API Level: 3

Methods

View Source

GetDistanceBetween(Double, Double, Double, Double)

Gets the distance between the two given coordinates.

Declaration
C#
Copy
public static double GetDistanceBetween(double startLatitude, double startLongitude, double endLatitude, double endLongitude)
Parameters
Type Name Description
System.Double startLatitude

The latitude of the source location [-90.0 ~ 90.0] (degrees).

System.Double startLongitude

The longitude of the source location[-180.0 ~ 180.0] (degrees).

System.Double endLatitude

The latitude of the source location [-90.0 ~ 90.0] (degrees).

System.Double endLongitude

The longitude of the source location[-180.0 ~ 180.0] (degrees).

Returns
Type Description
System.Double

Returns the distance between the source and the destination.

Exceptions
Type Condition
System.ArgumentException

Thrown when an invalid argument is used.

System.NotSupportedException

Thrown when the location is not supported.

API Level: 3
View Source

GetDistanceTo(Location)

Gets the distance between the current and the specified location.

Declaration
C#
Copy
public double GetDistanceTo(Location location)
Parameters
Type Name Description
Location location

The location object to which distance is to be calculated.

Returns
Type Description
System.Double

Returns the distance to the specified location.

Exceptions
Type Condition
System.ArgumentException

Thrown when an invalid argument is used.

System.NotSupportedException

Thrown when the location is not supported.

API Level: 3