GeoGenius.AreaMatch (geo_genius v0.2.0)

Copy Markdown View Source

One area returned by a catalog read, with whatever the read measured about it.

Every row-returning SQL function returns this shape. Which measurement fields carry a value depends on how the area was found: a containment match measures nothing, a proximity match sets distance_m, a geometry overlap sets the intersection and coverage fields, and a name search sets score.

coverage_of_input and coverage_of_area are percentages, 0 to 100. Only areas_for_geometry populates them. They are not the same scale as relation.parent_coverage, which is a 0-to-1 ratio and never reaches this struct.

Summary

Functions

Maps a query result into structs.

Types

t()

@type t() :: %GeoGenius.AreaMatch{
  area_key: String.t(),
  area_type: String.t() | nil,
  attributes: map() | nil,
  authority: String.t() | nil,
  centroid: Geo.Point.t() | nil,
  codes: %{optional(String.t()) => [String.t()]} | nil,
  collection_key: String.t() | nil,
  coverage_of_area: float() | nil,
  coverage_of_input: float() | nil,
  distance_m: float() | nil,
  intersection_area_m2: float() | nil,
  match_method: String.t() | nil,
  name: String.t() | nil,
  release_id: Ecto.UUID.t() | nil,
  score: float() | nil,
  type_rank: integer() | nil
}

Functions

from_result(result)

@spec from_result(Postgrex.Result.t()) :: [t()]

Maps a query result into structs.

Mapping is by column name. area_match declares sixteen columns, several of them the same type and adjacent, so a positional mapping would transpose two of them silently the first time the projection changed.