Geometry.PolygonM (Geometry v1.1.0)
View SourceA polygon struct, representing a 2D polygon with a measurement.
A non-empty line-string requires at least one ring with four coordinates.
Summary
Types
@type t() :: %Geometry.PolygonM{rings: [Geometry.ring()], srid: Geometry.srid()}
Functions
@spec new() :: t()
Creates an empty PolygonM
.
Examples
iex> PolygonM.new()
%PolygonM{rings: []}
@spec new([Geometry.LineStringM.t()], Geometry.srid()) :: t()
Creates a PolygonM
from the given rings
.
Examples
iex> PolygonM.new([
...> LineStringM.new([
...> PointM.new(35, 10, 14),
...> PointM.new(45, 45, 24),
...> PointM.new(10, 20, 34),
...> PointM.new(35, 10, 14)
...> ]),
...> LineStringM.new([
...> PointM.new(20, 30, 14),
...> PointM.new(35, 35, 24),
...> PointM.new(30, 20, 34),
...> PointM.new(20, 30, 14)
...> ])
...> ])
%PolygonM{
rings: [
[[35, 10, 14], [45, 45, 24], [10, 20, 34], [35, 10, 14]],
[[20, 30, 14], [35, 35, 24], [30, 20, 34], [20, 30, 14]]
],
srid: 0
}
iex> PolygonM.new()
%PolygonM{}