ArcSDE中有以下的空间关系判断函数:
空间操作 |
描述 |
ST_EnvIntersects |
矩形的边界满足ST_Intersects关系 |
ST_Intersects |
任意部分有相交,等价于判断空间关系的DE-9IM[1] 字符串表达是否是以下之一: T******** *T******* ***T***** ****T**** |
ST_Contains |
T*****FF* |
ST_Crosses |
T*T****** 0******** |
ST_Disjoint |
FF*FF**** |
ST_Equals |
T*F**FFF* |
ST_Overlaps |
T*T***T** |
ST_Touches |
FT******* F**T***** F***T**** |
ST_Within |
T*F**F*** |
ST_Relate |
判断是否满足DE-9IM字符串表达关系 |
类比上一节中的查询条件,以下的SQL在ArcSDE中实现了相同的操作:
SQL> select continent from continent where st_within(shape,st_geometry('POLYGON((0 0,180 -90,180 90,0 0))',2))=1;
CONTINENT
---------------------------------------
Australia
SQL> select continent from continent where st_relate(shape,st_geometry('POLYGON((0 0,180 -90,180 90,0 0))',2), 'T*F**F***')=1;
CONTINENT
---------------------------------------
Australia
空间关系运算以世界洲界数据进行空间运算测试,因为这个数据的边界相对复杂,我们可以大概看一下这个数据的节点个数:
SQL> select t.continent,t.shape.numpts from continent t;
CONTINENT SHAPE.NUMPTS
--------------------------------------- ------------
Asia 42423
North America 65453
Europe 27437
Africa 7178
South America 11564
Oceania 4887
Australia 4018
Antarctica 20205
这样数量级(4千~6.5万)节点的数据应该可以更好地反映空间关系运算的性能。
Oracle Spatial:
SQL> select continent from continent where sdo_relate(geom, SDO_GEOMETRY(2003,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,1003,1),SDO_ORDINATE_ARRAY(0,0,180,-90,180,90,0,0)), 'mask=ANYINTERACT')='TRUE' ;
CONTINENT
---------------------------------------
Asia
Oceania
Antarctica
North America
Africa
Australia
已选择6行。
已用时间: 00: 00: 04.11
ArcSDE:
SQL> select continent from continent where st_intersects(shape,st_geometry('POLYGON((0 0,180 -90,180 90,0 0))',2))=1;
CONTINENT
---------------------------------------
Asia
North America
Africa
Oceania
Australia
Antarctica
已选择6行。
已用时间: 00: 00: 00.24
[1] http://docs.codehaus.org/display/GEOTDOC/Point+Set+Theory+and+the+DE-9IM+Matrix