gdal.LineStringPoints
An encapsulation of a LineString's points.
Table of Contents
Methods
add
-
point(s)
Adds point(s) to the line string. Also accepts any object with an x and y property.
Parameters:
-
point(s)
gdal.Point | Object | Array
Example:
lineString.points.add(new gdal.Point(1, 2));
lineString.points.add([
new gdal.Point(1, 2)
new gdal.Point(3, 4)
]);`
count
()
Integer
Returns the number of points that are part of the line string.
Returns:
forEach
-
callback
Iterates through all points using a callback function.
Parameters:
-
callback
FunctionThe callback to be called with each Point
Example:
lineString.points.forEach(function(point, i) { ... });`
Returns the point at the specified index.
Parameters:
-
index
Integer0-based index
Returns:
map
-
callback
Iterates through all rings using a callback function and builds an array of the returned values.
Parameters:
-
callback
FunctionThe callback to be called with each LineString
Example:
var result = polygon.rings.map(function(ring, i) {
return value;
});`
map
-
callback
Iterates through all points using a callback function and builds an array of the returned values.
Parameters:
-
callback
FunctionThe callback to be called with each Point
Example:
var result = lineString.points.map(function(point, i) {
return value;
});`
resize
-
count
Adjusts the number of points that make up the line string.
Parameters:
-
count
Integer
reverse
()
Reverses the order of all the points.
set
-
index
-
point
Sets the point at the specified index.
Parameters:
-
index
Integer0-based index
-
point
gdal.Point
Example:
lineString.points.set(0, new gdal.Point(1, 2));`
toArray
()
Array
Outputs all points as a regular javascript array.
Returns:
List of Point instances.