View Source Landmark.Measurement (Landmark v0.4.0)

Summary

Functions

Computes the bounding box for an object.

Takes two Geo.Points and finds the geographic bearing between them, i.e. the angle measured in degrees from the north line (0 degrees)

Computes the centroid as the mean of all vertices within the object.

Calculates the distance between two coordinates. Uses the Haversine formula to account for global curvature.

Functions

bbox(object)

@spec bbox(Geo.geometry() | [{number(), number()}]) ::
  {number(), number(), number(), number()} | nil

Computes the bounding box for an object.

Examples

iex> Landmark.Measurement.bbox(%Geo.LineString{coordinates: [{1, 2}, {4, 6}]})
{1, 2, 4, 6}

iex> Landmark.Measurement.bbox(%Geo.LineString{coordinates: []})
nil

bearing(point1, point2)

Takes two Geo.Points and finds the geographic bearing between them, i.e. the angle measured in degrees from the north line (0 degrees)

centroid(object)

Computes the centroid as the mean of all vertices within the object.

distance(from, to, unit \\ :kilometers)

Calculates the distance between two coordinates. Uses the Haversine formula to account for global curvature.

Default unit is kilometers.