LineString.from constructor
A line string geometry from a chain
of positions and optional bounds
.
The chain
iterable must contain at least two positions (or be empty).
The coordinate type of all positions in a chain should be the same.
Examples:
// a line string from 2D positions
LineString.from([
[10.0, 20.0].xy,
[12.5, 22.5].xy,
[15.0, 25.0].xy,
]);
// a line string from 3D positions
LineString.from([
[10.0, 20.0, 30.0].xyz,
[12.5, 22.5, 32.5].xyz,
[15.0, 25.0, 35.0].xyz,
]);
// a line string from measured 2D positions
LineString.from([
[10.0, 20.0, 40.0].xym,
[12.5, 22.5, 42.5].xym,
[15.0, 25.0, 45.0].xym,
]);
// a line string from measured 3D positions
LineString.from(
[
[10.0, 20.0, 30.0, 40.0].xyzm,
[12.5, 22.5, 32.5, 42.5].xyzm,
[15.0, 25.0, 35.0, 45.0].xyzm,
],
);
Implementation
factory LineString.from(Iterable<Position> chain, {Box? bounds}) =>
LineString(
PositionSeries.from(chain),
bounds: bounds,
);