Geospatial queries enable querying, filtering, and analyzing location-based data. SQLY supports operations for points, polygons, distances, and spatial joins.
You can filter records based on geographic coordinates.
query:
select: [id, name, location]
from: stores
where:
city: "San Francisco"This retrieves all stores located in San Francisco.
You can find locations within a certain radius of a given point.
query:
select: [id, name, location]
from: restaurants
where:
location:
within_distance:
point: [37.7749, -122.4194]
distance: 10kmThis retrieves all restaurants within 10 km of the given latitude/longitude (San Francisco coordinates).
Find records within a rectangular region.
query:
select: [id, name, location]
from: parks
where:
location:
within_bbox:
min: [37.70, -122.50]
max: [37.80, -122.40]This retrieves all parks within the defined latitude/longitude boundaries.
Geospatial joins allow comparing locations between datasets.
query:
select: [customers.id, customers.name]
from: customers
join: stores
on:
customers.location:
within_distance:
point: stores.location
distance: 5kmThis retrieves customers located within 5 km of any store.
- Use
within_distancefor radius-based queries. - Use
within_bboxto filter by rectangular regions. - Spatial joins enable location-based comparisons.