Maps API for JavaScript Developer's Guide

H.geo.Strip

Class Summary

A strip is a flat list of latitude, longitude, altitude tuples in a fixed order.

[ For full details, see the Class Details ]

Method Summary

Table 1. Methods
Methods

pushLatLngAlt (lat, lng, alt)

This method pushes a triple of lat, lng, alt to the end of the given strip.

spliceLatLngAlts (index, opt_nRemove, opt_latLngAlts) : {Array<number>}

This method splices the strip at the provided index, removing the specified number of items at that index and inserting the provided lat, lng, alt array.

insertLatLngAlt (index, lat, lng, alt)

This method inserts one set of lat, lng, alt values into the strip at the specified index.

removeLatLngAlt (index)

This method removes one set of lat, lng, alt values from the strip at the specified index.

pushPoint (geoPoint)

This method pushes the lat, lng, alt values from a caller-supplied H.geo.Point to the end of the given strip.

insertPoint (pointIndex, geoPoint)

This method inserts the lat, lng, alt values from a H.geo.Point into the list at the specified index.

removePoint (pointIndex)

This method removes one set of lat, lng, alt values from this strip at the virtual point index specified.

extractPoint (pointIndex, opt_out) : {H.geo.Point}

This method extracts a H.geo.Point from this strip at the virtual point index specified by the caller. If the extracted point has an alt value, the strip's altitude context will be supplied to the point.

eachLatLngAlt (eachFn, opt_start, opt_end)

This method is a utility method that iterates over the lat, lng, alt array and calls the provided function for each three elements passing to it the lat, lng and alt and the virtual point index as arguments.

getDBCs (opt_closed) : {number}

This method retrieves the number of times that legs in the given strip cross the International Date Line.

getPointCount () : {number}

This method retrieves the number of points stored in the given strip.

getLatLngAltArray () : {Array<number>}

This method retrieves the internal array that holds the lat, lng and alt values. Modifying this array directly can destroy the integrity of the strip. Use it only for read access.

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

This method retrieves the bounding box of the given strip.

static isDBC (lng1, lng2) : {boolean}

This method checks if a leg in the given strip crosses the International Date Line by examining two longitudes form taht leg.

static fromLatLngArray (latLngs) : {H.geo.Strip}

This method initializes a new strip with an array of lat, lng values. Arrays are expected to have an even length with the format [lat, lng, lat, lng, ...].

Class Description

A strip is a flat list of latitude, longitude, altitude tuples in a fixed order.

Constructor Details

H.geo.Strip(opt_latLngAlts, opt_ctx)

Parameters:
 
opt_latLngAlts:
{Array<number>=} [optional]
 
An optional array of latitude, longitude and altitude tuples to initialize the strip
opt_ctx:
{H.geo.AltitudeContext=} [optional]
 
An optional altitude context for all altitudes in the strip
Throws:
 
{H.lang.InvalidArgumentError}
 
If lat, lng, or alt values are invalid

Method Details

pushLatLngAlt (lat, lng, alt)

This method pushes a triple of lat, lng, alt to the end of the given strip.

Parameters:
 
lat:
{H.geo.Latitude}
 
A value indicating latitude
lng:
{H.geo.Longitude}
 
A value indicating longitude
alt:
{H.geo.Altitude}
 
A value indicating altitude
Throws:
 
{H.lang.InvalidArgumentError}
 
If lat, lng, or alt values are invalid

spliceLatLngAlts (index, opt_nRemove, opt_latLngAlts) : {Array<number>}

This method splices the strip at the provided index, removing the specified number of items at that index and inserting the provided lat, lng, alt array.

Parameters:
 
index:
{number}
 
The index at which to splice
opt_nRemove:
{number=} [optional]
 
The number of lat, lng, alt values to remove
opt_latLngAlts:
{Array<number>=} [optional]
 
The lat, lng, alt values to add
Returns:
 
{Array<number>}
An array of removed elements
Throws:
 
{H.lang.InvalidArgumentError}
 
If lat, lng, or alt values are invalid

insertLatLngAlt (index, lat, lng, alt)

This method inserts one set of lat, lng, alt values into the strip at the specified index.

Parameters:
 
index:
{number}
 
The index at which to add the element
lat:
{H.geo.Latitude}
 
The latitude to insert
lng:
{H.geo.Longitude}
 
The longitude to insert
alt:
{H.geo.Altitude}
 
The altitude to insert

removeLatLngAlt (index)

This method removes one set of lat, lng, alt values from the strip at the specified index.

Parameters:
 
index:
{number}
 
The index value to use

pushPoint (geoPoint)

This method pushes the lat, lng, alt values from a caller-supplied H.geo.Point to the end of the given strip.

Parameters:
 
geoPoint:
{H.geo.IPoint}
 
An object representing the point from which to extract the coordinates to be pushed to the end of the strip
Throws:
 
{H.lang.InvalidArgumentError}
 
If lat, lng, or alt values are invalid

insertPoint (pointIndex, geoPoint)

This method inserts the lat, lng, alt values from a H.geo.Point into the list at the specified index.

Parameters:
 
pointIndex:
{number}
 
The index value to use
geoPoint:
{H.geo.IPoint}
 
An object whose coordinates to insert in the strip

removePoint (pointIndex)

This method removes one set of lat, lng, alt values from this strip at the virtual point index specified.

Parameters:
 
pointIndex:
{number}
 
A value indicating the virtual point index

extractPoint (pointIndex, opt_out) : {H.geo.Point}

This method extracts a H.geo.Point from this strip at the virtual point index specified by the caller. If the extracted point has an alt value, the strip's altitude context will be supplied to the point.

Parameters:
 
pointIndex:
{number}
 
A value indicating the virtual point index into the strip
opt_out:
{H.geo.Point=} [optional]
 
An optional point object in which to store the lat, lng, alt values
Returns:
 
{H.geo.Point}
Either the opt_out point object or a new point object.

eachLatLngAlt (eachFn, opt_start, opt_end)

This method is a utility method that iterates over the lat, lng, alt array and calls the provided function for each three elements passing to it the lat, lng and alt and the virtual point index as arguments.

Example

var eachFn = function(lat, lng, alt, idx) {
  console.log("point", idx + ":", lat, lng, alt);
}
myStrip.eachLatLngAlt(eachFn); //iterates over each point and logs its latitude and longitude
Parameters:
 
eachFn:
{function(H.geo.Latitude, H.geo.Longitude, H.geo.Altitude, number)}
 
A function to be called for each triple of coordinates
opt_start:
{number=} [optional]
 
An optional value indicating the index from which to start iterating
opt_end:
{number=} [optional]
 
An optional value indicating the index at which to stop iterating

getDBCs (opt_closed) : {number}

This method retrieves the number of times that legs in the given strip cross the International Date Line.

Parameters:
 
opt_closed:
{boolean=} [optional]
 
A value indicating whether the strip is closed i.e. whether the last and first coordinates form the closing leg of a polygon)
Returns:
 
{number}
A value indicating the number of times the given strip crosses the International Date Line.

getPointCount () : {number}

This method retrieves the number of points stored in the given strip.

Returns:
 
{number}
A value indicating the number of points in the given strip

getLatLngAltArray () : {Array<number>}

This method retrieves the internal array that holds the lat, lng and alt values. Modifying this array directly can destroy the integrity of the strip. Use it only for read access.

Returns:
 
{Array<number>}
An array of raw lat, lng, alt values from the given strip

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

This method retrieves the bounding box of the given strip.

Note: The strip is treated as an open path. If the bounding rectangle for a closed shape is required, the closing leg must be merged in an extra step.

Returns:
 
{?H.geo.Rect}
An object representing the bounding rectangle of the given strip object

static isDBC (lng1, lng2) : {boolean}

This method checks if a leg in the given strip crosses the International Date Line by examining two longitudes form taht leg.

Parameters:
 
lng1:
{H.geo.Longitude}
 
A value indicating the start longitude of the leg
lng2:
{H.geo.Longitude}
 
A value indicating the end longitude of the leg
Returns:
 
{boolean}
true if the leg crosses the date border, otherwise code false}

static fromLatLngArray (latLngs) : {H.geo.Strip}

This method initializes a new strip with an array of lat, lng values. Arrays are expected to have an even length with the format [lat, lng, lat, lng, ...].

Parameters:
 
latLngs:
{Array<number>}
 
The array of lat, lng values.
Returns:
 
{H.geo.Strip}
An initialized strip object containing the supplied array of values
Throws:
 
{H.lang.InvalidArgumentError}
 
If lat, lng, or alt values are invalid

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.