Maps API for JavaScript Developer's Guide

H.geo.Point

Class Summary

Implements: H.geo.IPoint

Extends: H.geo.AbstractGeometry

This class represents a geographical point, which is defined by its latitude, longitude and optional altitude.

[ For full details, see the Class Details ]

Property Summary

Table 1. Properties
Properties

lat : {H.geo.Latitude}

This property represents the latitude of the point.

lng : {H.geo.Longitude}

This property represents the longitude of the point.

alt : {H.geo.Altitude}

This property represents the altitude of the point.

ctx : {H.geo.AltitudeContext}

This property represents the altitude context.

Method Summary

Table 2. Methods
Methods

equals (other) : {boolean}

This method checks if the given point is equal to the point supplied by the caller. Two points are considered equal if they have the same lat and lng as well as equivalent values for alt and ctx.

distance (other) : {number}

This method calculates the distance between the given point and the point supplied by the caller. The method uses the Haversine formula. The altitude is not considered.

walk (bearing, distance, opt_overGreatCircle) : {H.geo.Point}

This method obtains the coordinates of a location, based on the distance from the given point and bearing specified by the caller. The altitude is ignored, instead the WGS84 Mean Radius is taken.

static validate (point, opt_caller, opt_argNr) : {boolean}

This method validates the given instance of Point. It checks if lat, lng, alt and ctx have valid types. Additionally, the method checks if the value of the lat property is in the range [-90 ... +90], the modulo of the value of lng in the range [-180 ... +180], and it validates the values of alt and ctx properties.

static fromIPoint (iPoint) : {H.geo.Point}

This method creates a Point instance from an IPoint object.

getBounds () : {?H.geo.Rect}

This method returns the bounding rectangle of the geometry.

Class Description

This class represents a geographical point, which is defined by its latitude, longitude and optional altitude.

Example

var geoPoint = new H.geo.Point(1, 51);

Constructor Details

H.geo.Point(lat, lng, opt_alt, opt_ctx)

Parameters:
 
lat:
{H.geo.Latitude}
 
A value indiating latitude
lng:
{H.geo.Longitude}
 
A value indicating longitude
opt_alt:
{H.geo.Altitude=} [optional]
 
A value indicating altitude
opt_ctx:
{H.geo.AltitudeContext=} [optional]
 
The altitude context

Property Details

lat: {H.geo.Latitude}

This property represents the latitude of the point.

lng: {H.geo.Longitude}

This property represents the longitude of the point.

alt: {H.geo.Altitude}

This property represents the altitude of the point.

ctx: {H.geo.AltitudeContext}

This property represents the altitude context.

Method Details

equals (other) : {boolean}

This method checks if the given point is equal to the point supplied by the caller. Two points are considered equal if they have the same lat and lng as well as equivalent values for alt and ctx.

Parameters:
 
other:
{H.geo.IPoint}
 
An object representing the point to check against the given point
Returns:
 
{boolean}
true if the two points are equal, otherwise false

distance (other) : {number}

This method calculates the distance between the given point and the point supplied by the caller. The method uses the Haversine formula. The altitude is not considered.

Parameters:
 
other:
{H.geo.IPoint}
 
An object representing the point to which to calculate the distance
Returns:
 
{number}
A value indicating the distance between the given location and the location supplied by the caller in meters

walk (bearing, distance, opt_overGreatCircle) : {H.geo.Point}

This method obtains the coordinates of a location, based on the distance from the given point and bearing specified by the caller. The altitude is ignored, instead the WGS84 Mean Radius is taken.

Parameters:
 
bearing:
{number}
 
A value indicating the bearing to use in the calculation in degrees
distance:
{number}
 
A value indicating the distance to the destination in meters
opt_overGreatCircle:
{boolean=} [optional]
 
true means that the computation is to use the "Great Circle", otherwise it uses "Rhumb Line".
Returns:
 
{H.geo.Point}
An object representing the calculated point

static validate (point, opt_caller, opt_argNr) : {boolean}

This method validates the given instance of Point. It checks if lat, lng, alt and ctx have valid types. Additionally, the method checks if the value of the lat property is in the range [-90 ... +90], the modulo of the value of lng in the range [-180 ... +180], and it validates the values of alt and ctx properties.

Parameters:
 
point:
{H.geo.IPoint}
 
An object representing the point to validate
opt_caller:
{Function=} [optional]
 
The caller to use to throw InvalidArgumentError, if omitted no error is thrown
opt_argNr:
{number=} [optional]
 
The argument number to use for InvalidArgumentError
Returns:
 
{boolean}
true if the given point is valid, otherwise false

static fromIPoint (iPoint) : {H.geo.Point}

This method creates a Point instance from an IPoint object.

Parameters:
 
iPoint:
{H.geo.IPoint}
 
The IPoint object to use
Returns:
 
{H.geo.Point}
The newly created Point instance

getBounds () : {?H.geo.Rect}

This method returns the bounding rectangle of the geometry.

Returns:
 
{?H.geo.Rect}
bounding rectangle of the geometry.

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.