对包含 ST_Geometry 列的表执行 SQL 查询可返回表的相关信息,也可以对不同表中要素的空间关系进行比较,或者通过输入表生成新几何。
使用空间索引对 ST_Geometry 列进行查询
下表中的示例空间查询使用了地理数据库的空间索引,此数据库中使用了 ST_Geometry 类型。
DB2
|
db2 => SELECT sa.name "Sensitive Areas", hs.name "Hazardous Sites"
FROM sensitive_areas sa, hazardous_sites hs
WHERE db2gse.st_overlaps (sa.zone, db2gse.st_buffer (hs.location,.01)) = 1
|
Informix
|
SELECT sa.name sensitive_area, hs.name hazardous_site
FROM sensitive_areas sa, hazardous_sites hs
WHERE st_overlaps(sa.zone, st_buffer(hs.location, .01)) = 't';
|
Oracle
|
SELECT sa.name "Sensitive Areas", hs.name "Hazardous Sites"
FROM sensitive_areas sa, hazardous_sites hs
WHERE sde.st_overlaps (sa.zone, sde.st_buffer(hs.location,.01)) = 1;
|
PostgreSQL
|
SELECT sa.name AS sensitive_area, hs.name AS hazardous_sites
FROM sensitive_areas sa, hazardous_sites hs
WHERE st_overlaps(sa.zone, st_buffer(hs.location,.01) = 't');
|
SQL 空间查询
9/15/2013