Geometry.GeometryCollection (Geometry v1.1.0)
View SourceA collection set of 2D geometries.
GeometryCollection
implements the protocols Enumerable
and Collectable
.
Examples
iex> Enum.map(
...> GeometryCollection.new([
...> Point.new(11, 12),
...> LineString.new([
...> Point.new(21, 22),
...> Point.new(31, 32)
...> ])
...> ]),
...> fn
...> %Point{} -> :point
...> %LineString{} -> :line_string
...> end
...> ) |> Enum.sort()
[:line_string, :point]
iex> Enum.into([Point.new(1, 2)], GeometryCollection.new())
%GeometryCollection{geometries: [%Point{coordinates: [1, 2]}]}
Summary
Types
@type t() :: %Geometry.GeometryCollection{geometries: [], srid: Geometry.srid()}
Functions
@spec new() :: t()
Creates an empty GeometryCollection
.
Examples
iex> GeometryCollection.new()
%GeometryCollection{geometries: [], srid: 0}
@spec new([Geometry.t()], Geometry.srid()) :: t()
Creates an empty GeometryCollection
.
Examples
iex> GeometryCollection.new([
...> Point.new(1, 2),
...> LineString.new([Point.new(1, 1), Point.new(2, 2)])
...> ])
%GeometryCollection{geometries: [
%Point{coordinates: [1, 2]},
%LineString{path: [[1, 1], [2, 2]]}
],
srid: 0}