GeoMeasure.Centroid (GeoMeasure v0.0.1)

View Source

Calculates the centroid of a Geo struct.

Examples:

iex> GeoMeasure.Centroid.centroid(%Geo.Point{coordinates: {1, 2}})
%Geo.Point{coordinates: {1, 2}}

iex> GeoMeasure.Centroid.centroid(%Geo.LineString{coordinates: [{1, 2}, {3, 4}]})
%Geo.Point{coordinates: {2.0, 3.0}}

iex> GeoMeasure.Centroid.centroid(%Geo.Polygon{coordinates: [[{0, 0}, {0, 2}, {2, 2}, {2, 0}, {0, 0}]]})
%Geo.Point{coordinates: {1.0, 1.0}}

Summary

Functions

Calculates the centroid of a Geo struct as a Geo.Point.

Functions

centroid(point)

(since 0.0.1)
@spec centroid(Geo.Point.t()) :: Geo.Point.t()
@spec centroid(Geo.LineString.t()) :: Geo.Point.t()
@spec centroid(Geo.Polygon.t()) :: Get.Point.t()

Calculates the centroid of a Geo struct as a Geo.Point.