View Source Geometry.GeometryCollectionM (Geometry v0.4.0)

A collection set of 2D geometries with a measurement.

GeometryCollectionM implements the protocols Enumerable and Collectable.

examples

Examples

iex> Enum.map(
...>   GeometryCollectionM.new([
...>     PointM.new(11, 12, 14),
...>     LineStringM.new([
...>       PointM.new(21, 22, 24),
...>       PointM.new(31, 32, 34)
...>     ])
...>   ]),
...>   fn
...>     %PointM{} -> :point
...>     %LineStringM{} -> :line_string
...>   end
...> ) |> Enum.sort()
[:line_string, :point]

iex> Enum.into([PointM.new(1, 2, 4)], GeometryCollectionM.new())
%GeometryCollectionM{geometries: [%PointM{coordinate: [1, 2, 4]}]}

Link to this section Summary

Functions

Creates an empty GeometryCollectionM.

Creates an empty GeometryCollectionM.

Link to this section Types

@type t() :: %Geometry.GeometryCollectionM{geometries: [Geometry.t()]}

Link to this section Functions

@spec new() :: t()

Creates an empty GeometryCollectionM.

examples

Examples

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

Creates an empty GeometryCollectionM.

examples

Examples

iex> GeometryCollectionM.new([
...>   PointM.new(1, 2, 4),
...>   LineStringM.new([PointM.new(1, 1, 1), PointM.new(2, 2, 2)])
...> ])
%GeometryCollectionM{geometries: [
  %PointM{coordinate: [1, 2, 4]},
  %LineStringM{points: [[1, 1, 1], [2, 2, 2]]}
]}