5 Geo coordinates
GeoCoordinate (in Relatude.DB.Common) is a WGS84 latitude and longitude. It is a small
readonly struct, and an indexed GeoCoordinate property answers radius queries from a spatial index.
using Relatude.DB.Common;
public interface IVenue {
// ...
[GeoCoordinateProperty(Indexed = true)] // index it for radius queries
GeoCoordinate Location { get; set; }
}- Constructing and reading
- The empty value — GeoCoordinate.Empty, the default value, means "no location":
- Distance and radius tests — Inside a query, IsWithin(center, meters) uses the spatial index (§22).
- Precision and sort order — A coordinate snaps to a grid of about 1 cm when you construct it, so a stored value reads back equal to what you wrote. Values sort along a Z-order curve. That keeps index scans fast but means nothing to a reader, so…
- JSON shape — GeoCoordinate serialises as {"latitude": 59.91, "longitude": 10.75}, and Empty as null. When reading, it also accepts lat, lon and lng, and a "latitude, longitude" string.
- Seeing them — The admin UI's query page has a Map view. It draws a GeoCoordinate property of the current result on a map or a globe, as pins, a heat map, clusters or shaded countries. Nodes without a location are left out. An indexed…