Geometry.GeometryCollectionM (Geometry v1.1.0)

View Source

A collection set of 2D geometries with a measurement.

GeometryCollectionM implements the protocols Enumerable and Collectable.

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{coordinates: [1, 2, 4]}], srid: 0}

Summary

Functions

Creates an empty GeometryCollectionM.

Creates an empty GeometryCollectionM.

Types

t()

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

Functions

new()

@spec new() :: t()

Creates an empty GeometryCollectionM.

Examples

iex> GeometryCollectionM.new()
%GeometryCollectionM{}

new(geometries, srid \\ 0)

@spec new([Geometry.t()], Geometry.srid()) :: t()

Creates an empty GeometryCollectionM.

Examples

iex> GeometryCollectionM.new([
...>   PointM.new(1, 2, 4),
...>   LineStringM.new([PointM.new(1, 1, 1), PointM.new(2, 2, 2)])
...> ])
%GeometryCollectionM{geometries: [
  %PointM{coordinates: [1, 2, 4]},
  %LineStringM{path: [[1, 1, 1], [2, 2, 2]]}
],
srid: 0}