Geometry.PolygonZM (Geometry v1.0.0)

View Source

A polygon struct, representing a 3D polygon with a measurement.

A non-empty line-string requires at least one ring with four coordinates.

Summary

Functions

Creates an empty PolygonZM.

Creates a PolygonZM from the given rings.

Types

t()

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

Functions

new()

@spec new() :: t()

Creates an empty PolygonZM.

Examples

iex> PolygonZM.new()
%PolygonZM{rings: []}

new(rings, srid \\ 0)

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

Creates a PolygonZM from the given rings.

Examples

iex> 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)
...>   ])
...> ])
%PolygonZM{
  rings: [
    [[35, 10, 13, 14], [45, 45, 23, 24], [10, 20, 33, 34], [35, 10, 13, 14]],
    [[20, 30, 13, 14], [35, 35, 23, 24], [30, 20, 33, 34], [20, 30, 13, 14]]
  ],
  srid: 0
}

iex> PolygonZM.new()
%PolygonZM{}