Geometry.Point (Geometry v1.1.0)

View Source

A point struct, representing a 2D point.

Summary

Functions

Creates an empty Point.

Creates a Point from the given coordinate.

Creates a Point from the given x and y, or a coordinate and an srid

Creates a Point from the given x and y.

Types

t()

@type t() :: %Geometry.Point{
  coordinates: Geometry.coordinates() | [],
  srid: Geometry.srid()
}

Functions

new()

@spec new() :: t()

Creates an empty Point.

Examples

iex> Point.new()
%Point{coordinates: []}

new(coordinate)

@spec new(Geometry.coordinates()) :: t()

Creates a Point from the given coordinate.

Examples

iex> Point.new([1.5, -2.1])
%Point{coordinates: [1.5, -2.1], srid: 0}

new(coordinate, srid)

@spec new(Geometry.coordinates() | [], Geometry.srid()) :: t()
@spec new(number(), number()) :: t()

Creates a Point from the given x and y, or a coordinate and an srid

Examples

iex> Point.new(-1.1, 2.2)
%Point{coordinates: [-1.1, 2.2], srid: 0}

new(x, y, srid)

@spec new(number(), number(), Geometry.srid()) :: t()

Creates a Point from the given x and y.

Examples

iex> Point.new(-1.1, 2.2, 4326)
%Point{coordinates: [-1.1, 2.2], srid: 4326}