HERE Android SDK Developer's Guide

GeoCoordinate

The class GeoCoordinate is a member of com.here.android.mpa.common .

Class Summary

public final class GeoCoordinate

extends java.lang.Object

Represents a WGS84 coordinate with double precision.

[For complete information, see the section Class Details]

Constructor Summary

Table 1. Constructors in GeoCoordinate
Constructors

GeoCoordinate (double latitude, double longitude)

Creates a GeoCoordinate with specified latitude and longitude values.

GeoCoordinate (double latitude, double longitude, double altitude)

Creates a GeoCoordinate with specified latitude, longitude and altitude values.

GeoCoordinate (GeoCoordinate coordinate)

Creates a copy of an existing GeoCoordinate object.

Field Summary

Table 2. Fields in GeoCoordinate
Fields

public static final int UNKNOWN_ALTITUDE

Definition of an unknown altitude.

Method Summary

Table 3. Methods in GeoCoordinate
Methods

public double distanceTo (GeoCoordinate coord)

Calculates the distance (using the Haversine formula), as measured in meters, between this GeoCoordinate and the specified GeoCoordinate .

public boolean equals (Object other)

For documentation, see java.lang.Object

public double getAltitude ()

Gets the current altitude, as measured in meters above sea level, of the GeoCoordinate (z-axis on a map).

public double getHeading (GeoCoordinate coord)

Returns heading from this point to the given coordinate in degrees.

public double getLatitude ()

Gets the current latitude, as measured in degrees, of the GeoCoordinate .

public double getLongitude ()

Gets the current longitude, as measured in degrees, of the GeoCoordinate .

public int hashCode ()

For documentation, see java.lang.Object

public boolean isValid ()

Determines whether the GeoCoordinate object is valid.

public void setAltitude (double altitude)

Sets an altitude value, in meters above sea level, for the GeoCoordinate .

public void setLatitude (double latitude)

Sets a latitude value, in degrees, for the GeoCoordinate .

public void setLongitude (double longitude)

Sets a longitude value, in degrees, for the GeoCoordinate .

public String toString ()

For documentation, see java.lang.Object

Class Details

Represents a WGS84 coordinate with double precision. A GeoCoordinate encapsulates a latitude and longitude value, plus an optional altitude value.

Constructor Details

GeoCoordinate (double latitude, double longitude)

Creates a GeoCoordinate with specified latitude and longitude values.

Parameters:

  • latitude

    Initial latitude value, in degrees, between -90.0 and 90.0 inclusive. If a passed value is above the maximum or below the minimum, it will be adjusted to the nearest acceptable value

  • longitude

    Initial longitude value, in degrees, greater than or equal to -180.0 and less than 180.0. Any unsupported value will be converted to its equivalent within the supported range (e.g. a value of -200.0 will be corrected to 160.0 (-200.0 + 360.0))

See also:

GeoCoordinate(double, double, double)

GeoCoordinate (double latitude, double longitude, double altitude)

Creates a GeoCoordinate with specified latitude, longitude and altitude values.

Parameters:

  • latitude

    Initial latitude value, in degrees, between -90.0 and 90.0 inclusive. If a passed value is above the maximum or below the minimum, it will be adjusted to the nearest acceptable value

  • longitude

    Initial longitude value, in degrees, greater than or equal to -180.0 and less than 180.0. Any unsupported value will be converted to its equivalent within the supported range (e.g. a value of -200.0 will be corrected to 160.0 (-200.0 + 360.0))

  • altitude

    Initial altitude value, in meters, between -10000.0 and 10000.0 inclusive. If a passed value is above the maximum or below the minimum, it will be adjusted to the nearest acceptable value

See also:

GeoCoordinate(double, double)

GeoCoordinate(GeoCoordinate)

GeoCoordinate (GeoCoordinate coordinate)

Creates a copy of an existing GeoCoordinate object.

Parameters:

  • coordinate

    A GeoCoordinate object used to initialize the new GeoCoordinate

See also:

GeoCoordinate(double, double, double)

GeoCoordinate(double, double)

Field Details

public static final int UNKNOWN_ALTITUDE

Definition of an unknown altitude.

Method Details

public double distanceTo (GeoCoordinate coord)

Calculates the distance (using the Haversine formula), as measured in meters, between this GeoCoordinate and the specified GeoCoordinate .

Parameters:

  • coord

    A second GeoCoordinate some distance away

Returns:

The distance between the coordinates

public boolean equals (Object other)

For documentation, see java.lang.Object

Parameters:

  • other

public double getAltitude ()

Gets the current altitude, as measured in meters above sea level, of the GeoCoordinate (z-axis on a map).

Returns:

The current altitude (returns 0.0 if the altitude is unavailable)

public double getHeading (GeoCoordinate coord)

Returns heading from this point to the given coordinate in degrees.

Parameters:

  • coord

    A second GeoCoordinate to which the heading is calculated

Returns:

Heading from this coordinate to the given coordinate, in degrees, from north increasing clockwise.

public double getLatitude ()

Gets the current latitude, as measured in degrees, of the GeoCoordinate . Latitude represents the north-south coordinate, or the y-axis on a map.

Returns:

The current latitude

public double getLongitude ()

Gets the current longitude, as measured in degrees, of the GeoCoordinate . Longitude represents the east-west coordinate, or the x-axis on a map.

Returns:

The current longitude

public int hashCode ()

For documentation, see java.lang.Object

public boolean isValid ()

Determines whether the GeoCoordinate object is valid. An invalid GeoCoordinate may be returned by PositioningManager if there is no positive lock on a GPS position.

Returns:

True if the GeoCoordinate is valid, false otherwise

public void setAltitude (double altitude)

Sets an altitude value, in meters above sea level, for the GeoCoordinate .

Parameters:

  • altitude

    A double-precision altitude value, a range of between -10000.0 and 10000.0 inclusive. If an invalid value is specified, it will be adjusted to the closest possible altitude value (For example, a specified value of -10200.0 will be set to -10000.0)

public void setLatitude (double latitude)

Sets a latitude value, in degrees, for the GeoCoordinate .

Parameters:

  • latitude

    A double-precision latitude value, a range between -90.0 and 90.0 inclusive. If an invalid value is specified, it will be adjusted to the closest possible latitude value (For example, a specified value of -100 will be set to -90.0)

public void setLongitude (double longitude)

Sets a longitude value, in degrees, for the GeoCoordinate .

Parameters:

  • longitude

    A double-precision longitude value, a range between -180.0 and less than 180.0 inclusive. If an invalid value is specified, it will be adjusted to the closest possible longitude value (For example, a specified value of -200.0 will be set to 160.0)

public String toString ()

For documentation, see java.lang.Object