Skip to content

LineString

A GeoJSON line string.

The simplest line string is just a line: joining two points together.

Geo.LineString(
    Geo.Point(Geo.Longitude(0.0), Geo.Latitude(0.0)),
    Geo.Point(Geo.Longitude(5.0), Geo.Latitude(0.2)),
)

A more complex line string represents a path between multiple points, drawing a straight line between each two points.

Geo.LineString(
    Geo.Point(Geo.Longitude(0.0), Geo.Latitude(0.0)),
    Geo.Point(Geo.Longitude(5.0), Geo.Latitude(0.2)),
    Geo.Point(Geo.Longitude(6.0), Geo.Latitude(0.3)),
    Geo.Point(Geo.Longitude(6.1), Geo.Latitude(0.9)),
)

A line string can represent the outline of a polygon with any number of points.

External resources

Constructors

LineString

constructor(points: List<Geo.Point>)
constructor(vararg points: Geo.Point)

Constructs a LineString instance from multiple Point instances.

Types

Serializer

Properties

isClosed

Returns true if this line string is closed, i.e. the first and last points are the same.

points

The points that make up the line string.

At least 2 points must be present.

Functions

toString

open override fun toString(): String