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 lat, lng, alt to the end of this 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 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 of a H.geo.Point to the end of this strip.

insertPoint (pointIndex, geoPoint)

This method inserts the lat, lng, alt values of 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. 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 3 elements passing lat, lng and alt and the virtual point index as arguments.

getDBCs (opt_closed) : {number}

This method returns the number of times that legs in this strip cross the date border.

getPointCount () : {number}

This method return the number of points stored in this strip.

getLatLngAltArray () : {Array<number>}

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

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

This method returns the bounding box of this strip.

static isDBC (lng1, lng2) : {boolean}

This method checks whether two longitudes form a leg which crosses the date border.

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 triples to initialize the strip with.
opt_ctx:
{H.geo.AltitudeContext=} [optional]
 
An optional altitude context for all altitudes contained in this strip.

Method Details

pushLatLngAlt (lat, lng, alt)

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

Parameters:
 
lat:
{H.geo.Latitude}
 
lng:
{H.geo.Longitude}
 
alt:
{H.geo.Altitude}
 

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

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}
 

pushPoint (geoPoint)

This method pushes the lat, lng, alt values of a H.geo.Point to the end of this strip.

Parameters:
 
geoPoint:
{H.geo.IPoint}
 

insertPoint (pointIndex, geoPoint)

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

Parameters:
 
pointIndex:
{number}
 
geoPoint:
{H.geo.IPoint}
 

removePoint (pointIndex)

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

Parameters:
 
pointIndex:
{number}
 
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. If the extracted point has an alt value, the strip's altitude context will be supplied to the point.

Parameters:
 
pointIndex:
{number}
 
the virtual point index in the strip
opt_out:
{H.geo.Point=} [optional]
 
an optional point object to store the lat, lng, alt values
Returns:
 
{H.geo.Point}
returns 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 3 elements passing 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)}
 
the function to be called for each 3 elements
opt_start:
{number=} [optional]
 
an optional start index to iterate from
opt_end:
{number=} [optional]
 
an optional end index to iterate to

getDBCs (opt_closed) : {number}

This method returns the number of times that legs in this strip cross the date border.

Parameters:
 
opt_closed:
{boolean=} [optional]
 
indicates whether the strip is closed (i.e. whether the strip's last and first coordinates form the closing leg of a polygon)
Returns:
 
{number}
the amount of times this strip crosses the date border.

getPointCount () : {number}

This method return the number of points stored in this strip.

Returns:
 
{number}
the number of points in this strip

getLatLngAltArray () : {Array<number>}

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

Returns:
 
{Array<number>}
returns the raw lat, lng, alt values of this strip

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

This method returns the bounding box of this 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}
this strip's bounding rectangle

static isDBC (lng1, lng2) : {boolean}

This method checks whether two longitudes form a leg which crosses the date border.

Parameters:
 
lng1:
{H.geo.Longitude}
 
the start longitude of the leg
lng2:
{H.geo.Longitude}
 
the end longitude of the leg
Returns:
 
{boolean}
true if the leg crosses the date border, otherwise 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 value.
Returns:
 
{H.geo.Strip}
the strip containing the lat, lng values

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.