geom.LineString()

class geom.LineString(coords)
Arguments
  • coords (Array) – Coordinates array.

Create a new linestring.

Example Use

Sample code to new linestring:

>> var LineString = require("geoscript/geom").LineString;
>> var line = LineString([[-180, -90], [0, 0], [180, 90]]);
>> line.coordinates.length
3
>> line.length
402.49223594996215

Properties

In addition to the properties common to all geom.Geometry() subclasses, linestring geometries have the properties documented below.

LineString.endPoint

geom.Point() The last point in the linestring.

LineString.endPoints

Array List of start point and end point.

LineString.startPoint

geom.Point() The first point in the linestring.

Methods

Linestring geometries have the methods common to all geom.Geometry() subclasses.

LineString.interpolatePoint()
Arguments
  • positionNumber The position between 0 and 1.

Returns

geom.Point()

Returns a Point placed on the LineString at the given percentage along the LineString.

LineString.locatePoint()
Arguments
Returns

Number The position (0-1) or percentage of the Point along the LineString.

Returns a position or percentage between 0 and 1 of the Point along the LineString.

LineString.placePoint()
Arguments
Returns

geom.Point() The Point on the LineString.

Places or snaps the Point to the LineString.

LineString.subLine()
Arguments
  • startNumber The start position between 0 and 1.

  • endNumber The end position between 0 and 1.

Returns

geom.LineString() The sub LineString

Returns a position or percentage between 0 and 1 of the Point along the LineString.