View Source Geometry.MultiLineString (Geometry v0.4.0)

A set of line-strings from type Geometry.LineString

MultiLineStringMZ implements the protocols Enumerable and Collectable.

examples

Examples

iex> Enum.map(
...>   MultiLineString.new([
...>     LineString.new([
...>       Point.new(1, 2),
...>       Point.new(3, 4)
...>     ]),
...>     LineString.new([
...>       Point.new(1, 2),
...>       Point.new(11, 12),
...>       Point.new(13, 14)
...>     ])
...>   ]),
...>   fn line_string -> length line_string end
...> )
[2, 3]

iex> Enum.into(
...>   [LineString.new([Point.new(1, 2), Point.new(5, 6)])],
...>   MultiLineString.new())
%MultiLineString{
  line_strings: [[[1, 2], [5, 6]]]
}

Link to this section Summary

Functions

Creates an empty MultiLineString.

Creates a MultiLineString from the given Geometry.MultiLineStrings.

Link to this section Types

@type t() :: %Geometry.MultiLineString{line_strings: [Geometry.coordinates()]}

Link to this section Functions

@spec new() :: t()

Creates an empty MultiLineString.

examples

Examples

iex> MultiLineString.new()
%MultiLineString{}
@spec new([Geometry.LineString.t()]) :: t()

Creates a MultiLineString from the given Geometry.MultiLineStrings.

examples

Examples

iex> MultiLineString.new([
...>   LineString.new([
...>     Point.new(1, 2),
...>     Point.new(2, 3),
...>     Point.new(3, 4)
...>   ]),
...>   LineString.new([
...>     Point.new(10, 20),
...>     Point.new(30, 40)
...>   ])
...> ])
%Geometry.MultiLineString{
  line_strings: [
      [[1, 2], [2, 3], [3, 4]],
      [[10, 20], [30, 40]]
    ]
}

iex> MultiLineString.new([])
%MultiLineString{line_strings: []}