22 Geo queries
A radius filter is an ordinary Where clause. GeoCoordinate.IsWithin(center, meters) uses the
property's index when it has Indexed = true:
var oslo = new GeoCoordinate(59.9139, 10.7522);
// Accessible venues within 5 km of Oslo central
var nearby = db.Query<IVenue>()
.Where(v => v.Location.IsWithin(oslo, 5_000))
.Where(v => v.IsAccessible)
.Execute();- Sorting by distance — Sort by DistanceTo in the query. Nodes with no location come last:
- A widening search
- Things to remember about geo filters — GeoCoordinate.Empty means "no location". It never matches IsWithin, and its distance to anything is infinite. Distances are great-circle metres over a mean Earth radius of 6 371 km, and IsWithin is exact. Without Indexed…