Nokia Maps API Reference

Contents

Class nokia.maps.geo.Coordinate

Class Summary

This class represents a geographical location, a point on the map, defined in terms of its geographical coordinates latitude, longitude and (optionally) altitude. If a corresponding type is already provided by the platform, the product must not implement this class.

new nokia.maps.geo.Coordinate (lat, lng, [alt, [skipValidation]])
Method Summary
distance (coord) : Number This method calculates the distance between the location represented by the given instance of Coordinate and that supplied by the caller.
equals (other) : Boolean This method checks if the location supplied by the caller is the same as the location represented by the given instance of Coordinate.
static fromObject () This method attempts to create an instance of Coordinate from the supplied arguments.
static isValid (lat, lng, [alt]) : Boolean This method checks if the received arguments are numbers and in valid ranges.
toString () : String This method creates a string representation of the given instance of Coordinate.
walk (bearing, distance, [overGreatCircle]) : nokia.maps.geo.Coordinate This method calculates the geo coordinates of a destination point using the distance and bearing specified by the caller.
Field Summary
Number | undefined altitude Altitude in meters.
Number latitude Latitude in degrees.
Number longitude Longitude in degrees.
Direct Inheritance
Constructor Detail

This method initializes a new instance of Coordinate

new nokia.maps.geo.Coordinate(lat, lng, [alt, [skipValidation]])
Parameters:
{Number} lat Latitude in degrees; values must be in the range [-90, 90], otherwise the error IllegalArgument is thrown
{Number} lng Longitude in degrees; values must be in the range [-180, 180], otherwise the error IllegalArgument is thrown
{Number} [alt]: undefined Altitude in meters
{Boolean} [skipValidation]: false If true, validation of the latitude, longitude and altitude is not performed
Method Detail
distance (coord) : Number
This method calculates the distance between the location represented by the given instance of Coordinate and that supplied by the caller. The method uses the Haversine formula. Altitude is not considered.
Parameters:
{nokia.maps.geo.ICoordinate} coord An object representing the location to which the distance is to be calculated
Returns:
{Number} The distance between the given location and the location supplied by the caller in meters
equals (other) : Boolean
This method checks if the location supplied by the caller is the same as the location represented by the given instance of Coordinate. Only latitude and longitude are compared.
Parameters:
{nokia.maps.geo.Coordinate} other The location whose coordinates are to be compared against those in the given location object
Returns:
{Boolean} true if equal, otherwise false
static fromObject ()
This method attempts to create an instance of Coordinate from the supplied arguments. Valid arguments are:
  • an instance of nokia.maps.geo.Coordinate - if provided, no other arguments should be present
  • two number values representing latitude and longitude (in this order)
  • three number values representing latitude, longitude and altitude (in this order)
  • an array of two numbers, where the first element is latitude and the second longitude
  • an array of three numbers, where the first element is latitude, the second longitude and the third altitude
  • an object containing the properties latitude and longitude - for example, {latitude: 50.1299, longitude: 8.568}
  • an object containing the properties lat and lng - for example, {lat: 50.1299, lng: 8.568}
Returns:
A newly created instance of {nokia.maps.geo.Coordinate} or null
static isValid (lat, lng, [alt]) : Boolean
This method checks if the received arguments are numbers and in valid ranges. Altitude should not be passed. If it is passed it must be a number not Infinity. Strings are not supported.
Parameters:
{Number} lat The latitude in decimal degrees to validate
{Number} lng The longitude in decimal degrees to validate
{Number} [alt]: If supplied, the altitude in meters to validate
Returns:
{Boolean} true if the given values are valid; false otherwise
toString () : String
This method creates a string representation of the given instance of Coordinate.
Returns:
{String} The resulting string representation of the given location point object
walk (bearing, distance, [overGreatCircle]) : nokia.maps.geo.Coordinate
This method calculates the geo coordinates of a destination point using the distance and bearing specified by the caller.
Parameters:
{Number} bearing The bearing to use in the calculation in degrees
{Number} distance The distance to the destination in meters
{Boolean} [overGreatCircle]: false If true the computation uses the "Great Circle" otherwise "Rhumb Line".
Returns:
{nokia.maps.geo.Coordinate} The calculated target as a location object containing geo coordinates
Documentation generated on Thu Feb 09 2012 12:59:02 GMT+0100 (CET).