class LineString extends Geometry
A LineString Geometry.
You can create a LineString from a List of List of Doubles or a List of Points.
LineString line = new LineString([[1,2],[3,4],[4,5]]) LineString line = new LineString([new Point(111.0, -47), new Point(123.0, -48), new Point(110.0, -47)])
Or you an create a LineString from a repeated List of Doubles.
LineString line = new LineString([1,2],[3,4],[4,5])
Or you can create a LineString from a List of repeated Points.
LineString line = new LineString(new Point(1,2), new Point(3,4), new Point(4,5))
| Constructor and description |
|---|
LineString
(LineString line)Create a LineString from a JTS LineString. |
LineString
(java.util.List coordinates)Create a LineString from a List of List of Doubles or a List of Points. |
LineString
(java.util.List<java.lang.Double>[] coordinates)Create a LineString from a repeated List of Doubles. |
LineString
(java.awt.Point[] points)Create a LineString from a List of repeated Points. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
LineString |
addPoint(int index, Point pt)Add a Point at the given index |
|
LinearRing |
close()Close a LineString to create a LinearRing |
|
MultiPoint |
createPointsAlong(double distance)Create Points along the LineString with the given interval distance. |
|
Point |
getEndPoint()Get the end Point |
|
Point |
getStartPoint()Get the start Point |
|
Point |
interpolatePoint(double position)Interpolate a Point on this LineString at the given position from 0 to 1. |
|
boolean |
isClosed()Is this LineString closed? |
|
boolean |
isRing()Is this LineString a ring? |
|
double |
locatePoint(Point point)Locate the position of the Point along this LineString. |
|
LineString |
negative()Remove the last Point from this LineString to create a new LineString |
|
Point |
placePoint(Point point)Place the Point on the LineString |
|
MultiLineString |
plus(LineString line)Add this LineString with another to create a MultiLineString |
|
LineString |
plus(Point point)Add a Point to the end of this LineString |
|
LineString |
removePoint(int index)Remove the Point at the given index and create a new LineString |
|
LineString |
reverse()Create a new LineString where the coordinates are in reverse order |
|
LineString |
setPoint(int index, Point pt)Set or replace the Point at the given index to create a new LineString |
|
LineString |
subLine(double start, double end)Extract a sub LineString from this LineString from the start and end positions. |
Create a LineString from a JTS LineString.
LineString line = new LineString(jtsLineString)
line - The JTS LineStringCreate a LineString from a List of List of Doubles or a List of Points.
LineString line = new LineString([[1,2],[3,4],[4,5]]) LineString line = new LineString([new Point(111.0, -47), new Point(123.0, -48), new Point(110.0, -47)])
coordinates - A List of Coordinates as a List of List of Doubles or a List of PointsCreate a LineString from a repeated List of Doubles.
LineString line = new LineString([1,2],[3,4],[4,5])
coordinates - A repeated of List of Doubles.Create a LineString from a List of repeated Points.
LineString line = new LineString(new Point(1,2), new Point(3,4), new Point(4,5))
points - A List of repated PointsAdd a Point at the given index
index - The index where to insert the Pointpt - The Point to addClose a LineString to create a LinearRing
Create Points along the LineString with the given interval distance.
distance - The interval distance of distance between points.Interpolate a Point on this LineString at the given position from 0 to 1.
position - The position along the LineString from 0 to 1Is this LineString closed?
Is this LineString a ring?
Locate the position of the Point along this LineString.
point - The PointRemove the last Point from this LineString to create a new LineString
Place the Point on the LineString
point - The PointAdd this LineString with another to create a MultiLineString
line - Another LineStringAdd a Point to the end of this LineString
point - The PointRemove the Point at the given index and create a new LineString
index - The index of the Point to removeCreate a new LineString where the coordinates are in reverse order
Set or replace the Point at the given index to create a new LineString
index - The index of the Point we want to replacept - The new PointExtract a sub LineString from this LineString from the start and end positions.
start - The start position.end - The end position.