Geometry.PolygonZ (Geometry v1.1.0)

View Source

A polygon struct, representing a 3D polygon.

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

Summary

Functions

Creates an empty PolygonZ.

Creates a PolygonZ from the given rings.

Types

t()

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

Functions

new()

@spec new() :: t()

Creates an empty PolygonZ.

Examples

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

new(rings, srid \\ 0)

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

Creates a PolygonZ from the given rings.

Examples

iex> PolygonZ.new([
...>   LineStringZ.new([
...>     PointZ.new(35, 10, 13),
...>     PointZ.new(45, 45, 23),
...>     PointZ.new(10, 20, 33),
...>     PointZ.new(35, 10, 13)
...>   ]),
...>   LineStringZ.new([
...>     PointZ.new(20, 30, 13),
...>     PointZ.new(35, 35, 23),
...>     PointZ.new(30, 20, 33),
...>     PointZ.new(20, 30, 13)
...>   ])
...> ])
%PolygonZ{
  rings: [
    [[35, 10, 13], [45, 45, 23], [10, 20, 33], [35, 10, 13]],
    [[20, 30, 13], [35, 35, 23], [30, 20, 33], [20, 30, 13]]
  ],
  srid: 0
}

iex> PolygonZ.new()
%PolygonZ{}