Show:

An encapsulation of a LineString's points.

Methods

add
(
  • points
)

Adds point(s) to the line string. Also accepts any object with an x and y property.

Parameters:

Example:

lineString.points.add(new gdal.Point(1, 2));
lineString.points.add([
    new gdal.Point(1, 2)
    new gdal.Point(3, 4)
]);`
add
(
  • x
  • y
  • z
)

Parameters:

  • x Number
  • y Number
  • [z] Number optional
count () Number

Returns the number of points that are part of the line string.

Returns:

Number
forEach
(
  • callback
)

Iterates through all points using a callback function.

Parameters:

  • callback forEachCb

    The callback to be called with each Point

Example:

lineString.points.forEach(function(array, i) { ... });`
get
(
  • index
)
gdal.Point

Returns the point at the specified index.

Parameters:

  • index Number

    0-based index

Returns:

map<U>
(
  • callback
)
U[]

Iterates through points using a callback function and builds an array of the returned values.

Parameters:

  • callback mapCb

    The callback to be called with each Point

Returns:

U[]

Example:

var result = lineString.points.map(function(array, i) {
    return value;
});`
resize
(
  • count
)

Adjusts the number of points that make up the line string.

Parameters:

  • count Number
reverse ()

Reverses the order of all the points.

set
(
  • index
  • point
)

Sets the point at the specified index.

Parameters:

  • index Number

    0-based index

  • point gdal.Point | Xyz

Example:

lineString.points.set(0, new gdal.Point(1, 2));`
set
(
  • index
  • x
  • y
  • z
)

Parameters:

  • index Number

    0-based index

  • x Number
  • y Number
  • [z] Number optional
Symbol.iterator ()

Iterates through all points using an iterator

Example:

for (const array of lineString.points) {
}
toArray () gdal.Point[][]

Outputs all points as a regular javascript array.

Returns:

gdal.Point[][]:

List of Point instances.