Geometry.MultiPolygonZM (Geometry v1.1.0)

View Source

A set of polygons from type Geometry.PolygonZM

MultiPointZM implements the protocols Enumerable and Collectable.

Examples

iex> Enum.map(
...>   MultiPolygonZM.new([
...>     PolygonZM.new([
...>       LineStringZM.new([
...>         PointZM.new(11, 12, 13, 14),
...>         PointZM.new(11, 22, 23, 24),
...>         PointZM.new(31, 22, 33, 34),
...>         PointZM.new(11, 12, 13, 14)
...>       ]),
...>     ]),
...>     PolygonZM.new([
...>       LineStringZM.new([
...>         PointZM.new(35, 10, 13, 14),
...>         PointZM.new(45, 45, 23, 24),
...>         PointZM.new(10, 20, 33, 34),
...>         PointZM.new(35, 10, 13, 14)
...>       ]),
...>       LineStringZM.new([
...>         PointZM.new(20, 30, 13, 14),
...>         PointZM.new(35, 35, 23, 24),
...>         PointZM.new(30, 20, 33, 34),
...>         PointZM.new(20, 30, 13, 14)
...>       ])
...>     ])
...>   ]),
...>   fn polygon -> length(polygon) == 1 end
...> )
[true, false]

iex> Enum.into(
...>   [
...>     PolygonZM.new([
...>       LineStringZM.new([
...>         PointZM.new(11, 12, 13, 14),
...>         PointZM.new(11, 22, 23, 24),
...>         PointZM.new(31, 22, 33, 34),
...>         PointZM.new(11, 12, 13, 14)
...>       ])
...>     ])
...>   ],
...>   MultiPolygonZM.new())
%MultiPolygonZM{
  polygons: [
      [
        [
          [11, 12, 13, 14],
          [11, 22, 23, 24],
          [31, 22, 33, 34],
          [11, 12, 13, 14]
        ]
      ]
    ],
  srid: 0
}

Summary

Functions

Creates an empty MultiPolygonZM.

Creates a MultiPolygonZM from the given Geometry.MultiPolygonZMs.

Types

t()

@type t() :: %Geometry.MultiPolygonZM{
  polygons: [[Geometry.ring()]],
  srid: Geometry.srid()
}

Functions

new()

@spec new() :: t()

Creates an empty MultiPolygonZM.

Examples

iex> MultiPolygonZM.new()
%MultiPolygonZM{}

new(polygons, srid \\ 0)

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

Creates a MultiPolygonZM from the given Geometry.MultiPolygonZMs.

Examples

iex> MultiPolygonZM.new([
...>   PolygonZM.new([
...>     LineStringZM.new([
...>       PointZM.new(6, 2, 3, 4),
...>       PointZM.new(8, 2, 4, 5),
...>       PointZM.new(8, 4, 5, 6),
...>       PointZM.new(6, 2, 3, 4)
...>     ]),
...>   ]),
...>   PolygonZM.new([
...>     LineStringZM.new([
...>       PointZM.new(1, 1, 3, 4),
...>       PointZM.new(9, 1, 4, 5),
...>       PointZM.new(9, 8, 5, 6),
...>       PointZM.new(1, 1, 3, 4)
...>     ]),
...>     LineStringZM.new([
...>       PointZM.new(6, 2, 3, 4),
...>       PointZM.new(7, 2, 4, 5),
...>       PointZM.new(7, 3, 5, 6),
...>       PointZM.new(6, 2, 3, 4)
...>     ])
...>   ])
...> ])
%MultiPolygonZM{
  polygons: [
      [[[6, 2, 3, 4], [8, 2, 4, 5], [8, 4, 5, 6], [6, 2, 3, 4]]],
      [
        [[1, 1, 3, 4], [9, 1, 4, 5], [9, 8, 5, 6], [1, 1, 3, 4]],
        [[6, 2, 3, 4], [7, 2, 4, 5], [7, 3, 5, 6], [6, 2, 3, 4]]
      ]
    ],
    srid: 0
}

iex> MultiPolygonZM.new([])
%MultiPolygonZM{}