GreenFairy.CQL.Scalars.Coordinates (GreenFairy v0.3.0)
View SourceCQL scalar for geographic coordinates (latitude/longitude).
Provides geo-spatial operators including distance and bounding box queries.
Operators
:_eq/:_neq- Equality/inequality:_is_null- Null check:_st_dwithin- Distance within radius (PostGIS):_st_within_bounding_box- Within bounding box (PostGIS)
Adapter Variations
- PostgreSQL with PostGIS: Full spatial operator support
- MySQL: Limited spatial support (distance calculations only)
- Other adapters: Basic equality only
Input Format
Coordinates are represented as {lat, lng} tuples or %{lat: lat, lng: lng} maps.
Examples
# Distance within 5000 meters (5km)
where: {
location: {
_st_dwithin: {
point: {lat: 37.7749, lng: -122.4194},
distance: 5000
}
}
}
# Within bounding box
where: {
location: {
_st_within_bounding_box: {
sw: {lat: 37.7, lng: -122.5},
ne: {lat: 37.8, lng: -122.3}
}
}
}