Ash Resource Fragment for TMF675 GeographicLocation — geometry-bearing Place (a point or polygon region in WGS-84).
Compose with BasePlace on a concrete leaf to require the BasePlace geometry
attributes (location or bounds) be set, add the accuracy attribute, and
carry the TMF675 GeoJson wire shape through BasePlace's existing
encode_geo_json/2 customize.
Diffo.Provider.GeographicLocation uses this fragment directly as the
out-of-the-box TMF GeographicLocation resource. Domain extenders compose the
same two fragments on their own leaf.
Attributes
accuracy— float, meters of positional accuracy (TMF675accuracyfield). Free-form numeric; not constrained.
Geometry (inherited from BasePlace)
location—AshGeo.GeoJson(:point, WGS-84).%Geo.Point{coordinates: {lon, lat}, srid: 4326}.bounds—AshGeo.GeoJson(:polygon, WGS-84).%Geo.Polygon{coordinates: [ring], srid: 4326}.
Tightened validation
BasePlace already enforces:
- At most one of
[location, bounds]may be set. - Geometry is only allowed when
type == :GeographicLocation.
This fragment adds the inverse direction:
type == :GeographicLocationrequires at least one of[location, bounds]set.
Wire shape (TMF675)
Inherits BasePlace's encode_geo_json/2 customize which rebrands @type to
GeoJsonPoint or GeoJsonPolygon and emits the geometry as a TMF675 geoJson
field with @baseType: "GeographicLocation".