Spatial database: Difference between revisions

Content deleted Content added
m Spatial index: add tag "spatial access methods"
Line 52:
Function prototype: ''functionName (parameter(s)) : return type ''
 
* <code>ST_Distance(geometry, geometry) : number</code>
* <code>ST_Equals(geometry, geometry) : boolean</code>
* <code>ST_Disjoint(geometry, geometry) : boolean</code>
* <code>ST_Intersects(geometry, geometry) : boolean</code>
* <code>ST_Touches(geometry, geometry) : boolean</code>
* <code>ST_Crosses(geometry, geometry) : boolean</code>
* <code>ST_Overlaps(geometry, geometry) : boolean</code>
* <code>ST_Contains(geometry, geometry) : boolean</code>
* <code>ST_Length(geometry) : number</code>
* <code>ST_Area(geometry) : number</code>
* <code>ST_[[Centroid]](geometry) : geometry</code>
* <code>ST_Intersection(geometry, geometry) : geometry</code>
 
Thus, a [[spatial join]] between a points layer of cities and a polygon layer of countries could be performed in a spatially-extended SQL statement as:
 
<code>{{sxhl|2=postgres|SELECT * FROM cities, countries WHERE ST_Contains(countries.shape, cities.shape)</code>}}
 
The Intersect [[vector overlay]] operation (a core element of GIS software) could be replicated as:
 
<code>{{sxhl|2=postgres|SELECT ST_Intersection(veg.shape, soil.shape) int_poly, veg.*, soil.* FROM veg, soil where ST_Intersects(veg.shape, soil.shape)</code>}}
 
==Spatial database management systems==