Maps API for JavaScript Developer's Guide

H.geo.Point

Class Summary

Implements: H.geo.IPoint

Extends: H.geo.AbstractGeometry

A Point represents a geographical point.

[ 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

distance (other) : {number}

Returns the distance between the 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}

Returns the destination point, based on the given distance and bearing relative to the current point. The algorithm is based on the Haversine formula. The altitude is ignored, instead the WGS84 Mean Radius is taken.

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

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}

Returns the bounding rectangle of the geometry.

equals (other) : {boolean}

Checks whether the geometry is equal to the geometry supplied by the caller. Two geometries are considered as equal if they represent the same geometry type and have equal coordinate values.

toString () : {!string}

To obtain a Well-Known-Text (WKT) representation of the geometry.

Class Description

A Point represents a geographical point.

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 indicating 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

distance (other) : {number}

Returns the distance between the 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}

Returns the destination point, based on the given distance and bearing relative to the current point. The algorithm is based on the Haversine formula. The altitude is ignored, instead the WGS84 Mean Radius is taken.

Parameters:
 
bearing:
{number}
 
The bearing to the destination in degrees
distance:
{number}
 
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}

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}

Returns the bounding rectangle of the geometry.

Returns:
 
{?H.geo.Rect}
the bounding rectangle of the geometry or null if the bounding rectangle can't be computed (e.g. for a geometry without coordinates)

equals (other) : {boolean}

Checks whether the geometry is equal to the geometry supplied by the caller. Two geometries are considered as equal if they represent the same geometry type and have equal coordinate values.

Parameters:
 
other:
{*}
 
The geometry to check against
Returns:
 
{boolean}
true if the two geometries are equal, otherwise false

toString () : {!string}

To obtain a Well-Known-Text (WKT) representation of the geometry.

Returns:
 
{!string}
the resulting WKT string