Logical Data Models and Languages > Relational Model > Query language
A query language is connected to the operations of a spatial algebra
(including predicates for spatial relationships). Fundamental spatial
algebra operators are:
- Spatial selection
- Spatial join
- (overlay, fusion)
Spatial selection: It returns those objects that satisfy
a spatial predicate with the query object.
- All cities in Valencia SELECT sname FROM cities c WHERE inside(c.center,Valencia.area)
- All rivers intersecting a query window SELECT r.name FROM rivers r WHERE intersect(r.route,Window)
- All big cities no more than 100 Kms from Valencia SELECT cname FROM cities c WHERE dist(c.center, Valencia.center) 100
Spatial join: A join which compares any two joined objects based on a
predicate on their spatial attribute values.
- For each river that passes through Valencia, find all cities within less than 50 Kms.
SELECT r.rname, c.cname
FROM r in rivers, c in cities
WHERE r.route->intersect(Castilla.area) and r.route->dist(c.area)
< 50