Shape comparison language
形状比较语言, 九交模型
In this topic
- About shape comparison language
- Dimensionality
- Extensions to the CBM
- SCL syntactical
- Spatial relate function
- SCL usage examples

About shape comparison language
In the interest of supporting the Open Geodata Interoperability Specification (OGIS) and SQL3/MM initiatives, ESRI is implementing in SDE a language syntax for the evaluation of relationships between shapes, which will eventually replace the use of SDE search methods and search masks for defining search criteria, and for expressing relationships between shapes. The syntax of the shape comparison language (SCL) is based on the Calculus-Based Method (CBM) as described and defined by Clementini and Felice, with extensions.
The CBM defines shape relationships by the intersection of their boundary, interior, and exterior, taking the dimensionality of the intersection into account. The following are the five basic relationships: Touch, Overlap, In, Cross, and Disjoint. These relationships are defined such that for any two given shapes, only one of these five relationships is true. In addition, SCL supports the additional relationship of IDENTICAL, which is true only when two shapes are geometrically identical and share correct topological integrity.
The CBM and SCL perform relationship comparison to a maximum of two dimensions, thus SCL can only be used to describe zero, one, and two dimensional relationships. This is consistent with previous versions of SDE wherein the SDE search methods only described two dimensional relationships.
Dimensionality
To use SCL you must understand the following concepts of shape boundary and interior, as well as dimensionality:
- All point shapes are zero dimensional
- All linear shapes are one dimensional
- All area shapes are two dimensional
The previous is true for SCL regardless that the shape may or may not have z-coordinates or that it may have measures.
- Interior—The dimension of the interior of a shape is always that of the shape. Thus, the dimension of the interior of a linear shape is one. All shapes have interior. The interior of a shape is defined as the entire shape minus its boundary.
- Boundary—The dimension of the boundary of a shape is always that of the shape minus one. Thus, the dimension of the boundary of a linear shape is zero and the dimension of the boundary of any point shape is –1 or NIL. Linear and area shapes have boundary, but point shapes do not. The boundary of linear shapes consists of the end points of all linear parts. The boundary of area shapes consists of the linear boundary of the polygon shell or shells.
- Exterior—The dimension of the exterior of any shape is always two. All shapes have an exterior.
Extensions to the CBM
The CBM does not differentiate between an intersection that occurs at a shape vertice and an intersection that occurs between shape vertices. Because it is often crucial to maintain topological integrity between shapes, and to know when there is a lack of topological integrity between shapes, SCL has been extended as follows:
- TOPOFORM—A unary function that evaluates to true if topological integrity exists between two shapes, and false if there is a lack of topological integrity. A lack of topological integrity is defined as intersection that is other than topological adjacency.
SCL is used to describe the relationship between two specific or in the case of spatial searches, hypothetical shapes. SCL expressions evaluate to true or false, except in the case of the DIM functions, which evaluate to a dimension value.
The general form of an SCL statement consists of one or more spatial assertions. Multiple assertions may be connected into a single assertion using the logical connecting operators AND, OR, and XOR. Parenthetical expression hierarchy is supported. SCL expressions are not case dependent.
- Example 1: G1 NOT DISJOINT G2—The previous case evaluates true if the shapes g1 and g2 touch or overlap. Both G1 and G2 are reserved words that refer, respectively, to shape #1 and shape #2.
- Example 2: (g1 overlap g2 and dim (g2) = area) or (g2 cross g1 and dim (g2) = linear)—The previous case evaluates true if the g2 shape is an area and meets the intersection criteria defined by the overlap keyword or if the g2 shape is linear and meets the intersection criteria defined by the cross keyword.
SCL uses the numeric constants TRUE, FALSE, POINT, LINEAR, AREA, NIL, and NULL, rather than numeric literals. SCL does not support user variables or numeric literals. The terms NIL and NULL can be used interchangeably and are used to refer to a lack of a specific type of intersection.
SCL allows binary spatial relationships to be expressed as a function or as an operation between the two shape constants G1 and G2. For example, the expression G1 cross G2 is equivalent to the expression cross (g1, g2) = true. The expression G1 not cross G2 is equivalent to the expression cross (g1, g2) = false or cross (g1, g2) != true.
In SCL, the DIM function is two different functions, depending upon the number of arguments. If there is only one argument, it returns the dimensionality of a shape or shape component, such as dim (g1) or dim (g1.boundary). If there are two arguments, the dim function returns the dimension of intersection between the two expressed shapes or shape components, such as dim (g1, g2) or dim (g1.interior, g2.boundary).
Dimension functions
The dimension functions are the most powerful functions in SCL for the assertion of spatial relationships. The dimension function DIM takes one or two spatial object arguments and performs a different function depending on the number of arguments used. All of the Clementini relationship operators can be defined using these two DIM functions.
The spatial object modifiers boundary, interior, and exterior can only be used as modifiers for the spatial entity arguments to the DIM function. The modifier use form is: <spatial entity reference><period><spatial-modifier> in the form g1.boundary.
Returns the spatial dimension of a spatial entity or a component (boundary, interior, or exterior) of a spatial entity.
- Syntax: DIM (spatial-object)—Where spatial-object is one of the following:
G1
G1.BOUNDARY
G1.INTERIOR
G1.EXTERIOR
G2
G1.BOUNDARY
G1.INTERIOR
G1.EXTERIOR
Returns the spatial dimension of the referenced spatial object, which evaluates to one of the following supported dimension constants:
NIL, NULL (-1)
POINT 0
LINEAR 1
AREA 2
Usage examples:
"dim (g1.interior) >= linear"
"dim (g1) = dim(g2)"
"dim (g1) >= dim(g2.interior)"
Returns the spatial dimension of intersection between two spatial entities or components (boundary, interior, or exterior) of the entities.
- Syntax: DIM (spatial-object1, spatial-object2)—Where spatial-object1 and spatial-object2 are one of the following and both spatial objects may not refer to the same shape (G1 or G2):
G1
G1.BOUNDARY
G1.INTERIOR
G1.EXTERIOR
G2
G1.BOUNDARY
G1.INTERIOR
G1.EXTERIOR
Returns the spatial dimension of intersection between the referenced spatial objects, which evaluates to one of the following supported dimension constants:
NULL (-1)
POINT 0
LINEAR 1
AREA 2
Usage examples:
"dim(g1.interior,g2) >= linear"
"dim(g1,g2) = dim(g2)"
"dim(g1.boundary,g2.boundary) > point"
Spatial relationship functions and expressions
The CBM and SCL are not intuitive. It is essential to commit the following definitions to memory before using SCL. The following are the criteria for relationship evaluation:
- The seven spatial relationships can be expressed as functions or relations. For example, the following TOUCH relationship can be expressed as: A relation, "G1 TOUCH G2" or as a function, "touch (g1,g2) = true."
- The function form is "<function (spatial entity, spatial entity)> <equality operator> <truth constant>." The relation form is "<spatial entity> <relation name> <spatial entity>."
- The logic requirements of the relations TOUCH, CROSS, IN, CONTAIN, OVERLAP, and DISJOINT preclude the use of modifiers to spatial entity specifications; use G1 or G2 as spatial arguments and the use of modifiers, such as "G1.BOUNDARY" are not allowed.
- The INTERSECT relation does allow the use of the modifiers BOUNDARY, INTERIOR, and EXTERIOR to the spatial arguments G1 and G2. Examples of appropriate usage form are "g1.interior intersects g2.exterior" and "g1.boundary intersect g2."
- If the relationship is expressed as a function, you must compare the result of the function to the constants TRUE or FALSE, e.g., "intersect (g1,g2) = true."
TOUCH spatial relation
Applies to area/area, line/line, line/area, point/area, and point/line groups with the following criteria:
- The dimension of intersection between G1 and G2 is not null.
- The dimension of intersection between the interior of G1 and the interior of G2 is null.
"G1 TOUCH G2" is equivalent to the following statement: "dim(g1.interior, g2.interior) = null and dim(g1,g2) != null."
The following are expression options and examples:
"G1 TOUCH G2"
"G1 TOUCHES G2"
"G1 =* G2"
"TOUCH (G1,G2) = TRUE"
"TOUCHES (G1,G2) = TRUE"
CROSS spatial relation
Applies to line/line, line/area, point/area, and point/line groups with the following criteria:
- The dimension of intersection between G1 and the exterior of G2 is not null.
- The dimension of intersection between G2 and the exterior of G1 is not null.
- The dimension of intersection between the interior of G1 and the interior of G2 is not null and is less than the dimension of either or both of the interiors of G1 and G2.
"G1 CROSS G2" is equivalent to the following statement: "dim(g1.interior, g2.interior) != NIL and (dim(g1.interior, g2.interior) < dim(g1.interior) or dim(g1.interior, g2.interior) < dim(g2.interior)) and dim(g1, g2.exterior) != NIL and dim(g2, g1.exterior) != NIL."
The following are expression options and examples:
"G1 CROSS G2"
"G1 CROSSS G2"
"G1 =/ G2"
"CROSS (G1, G2) = TRUE"
"CROSSES (G1, G2) = TRUE"
IN or CONTAIN spatial relations
Applies to all group types with the following criteria:
- The intersection of the two shapes is equal to the shape defined as in or contained.
- The intersection of the two shapes interiors is not null.
"G2 IN G1" is equivalent to the following statement: "dim (g2, g1.exterior) = null and dim (g1.interior, g2.interior) != null"
The following are expression options and examples:
<P>"G1 IN G2"
<P>"G1 INSIDE G2"
<P>"G1 CONTAIN G2"
<P>"G1 CONTAINS G2"
<P>"G1 =@ G2"
<P>"IN (G1, G2) = TRUE" /* g1 contained by g2 */
<P>"INSIDE (G1, G2) = TRUE" /* g1 contained by g2 */
<P>"CONTAIN (G1, G2) = TRUE" /* g2 contained by g1 */
<P>"CONTAINS (G1, G2) = TRUE" /* g2 contained by g1 */
Applies to area/area, line/line, and point/point groups with the following criteria:
- The dimension of intersection between G1 and the exterior of G2 is not null.
- The dimension of intersection between G2 and the exterior of G1 is not null.
- The dimension of intersection of the two shapes interiors equals the dimension of the interior of both shapes.
"G1 OVERLAP G2" is equivalent to the following statement: "dim (g1) = dim (g2) and dim (g1) = dim (g1.interior, g2.interior) and dim (g1, g2.exterior) != NULL and dim (g2, g1.exterior) != NULL."
The following are expression options and examples:
"G1 OVERLAP G2"
"G1 OVERLAPS G2"
"G1 =& G2"
"OVERLAP (G1, G2) = TRUE"
"OVERLAPS (G1, G2) = TRUE"
IDENTICAL spatial relation
Applies to area/area, line/line, and point/point groups with the following criteria:
- The intersection between the two shapes equals each shape.
- Topological integrity exists between the two shapes ("topoform").
"G1 IDENTICAL G2" is equivalent to the following statement: "dim (g1) = dim (g2) and dim (g1,g2.exterior) = null and dim (g2,g1.exterior) = null and topoform = true."
The expression "G1 contains G2 and G2 contains G1" can be true in cases where there is a lack of topological integrity. If so, the expression "G1 identical G2" is false.
The following are expression options and examples:
"G1 IDENTICAL G2"
"G1 = G2"
"G1 == G2"
"IDENTICAL (G1, G2) = TRUE"
DISJOINT spatial relation
Applies to all group types with the following criteria:
- The intersection of G1 and G2 is NULL.
"G1 DISJOINT G2" is equivalent to "dim (g1, g2) = NULL."
The following are expression options and examples:
"G1 DISJOINT G2"
"G1 =! G2"
"DISJOINT (G1, G2) = TRUE"
INTERSECT spatial relation
Applies to all group types. The INTERSECT relation allows the use of modifiers with its spatial arguments. These modifiers are BOUNDARY, INTERIOR, and EXTERIOR with the following criteria:
- Evaluates to TRUE if the dimension of the specified intersection is not NULL.
"G1 INTERSECT G2" is equivalent to "dim (g1, g2) != NULL."
The following are expression options and examples:
"G1 INTERSECT G2.BOUNDARY"
"G1 =? G2"
"INTERSECT (G1.INTERIOR, G2.INTERIOR) = TRUE"
TOPOFORM spatial relation
Applies to all group types. This is a unary spatial relation that evaluates to TRUE or FALSE and must be compared with an equality operator and truth constant for evaluation.
The following are expression options and examples:
"TOPOFORM = TRUE"
Spatial relate function
The RELATE function is supported as unary function for testing against the entire 9IM array. The 9IM array has nine elements of comparison—three elements of each shape versus three elements of the other shape. These elements are boundary, interior, and exterior.
Each element for the first shape (G1) can be tested against each element of the second shape (G2) for truth or falsehood. Selected array elements can be selectively ignored.
- The following example is the syntax of the RELATE function:
"RELATE (G1, G2, 'FFFTTT***')"
RELATE is a unary function and is not compared to true or false.
In the previous example, shapes G1 and G2 are compared. The string 'FFFTTT***' delimited in single quotes, is used to specify whether the intersection of each of the elements in the 9IM array is true (T), false (F), or not tested (*). There are exactly nine elements in the string which correspond, from left to right, to the following nine relationships:
|
1 |
G1.interior |
G2.interior |
|
2 |
G1.interior |
G2.boundary |
|
3 |
G1.interior |
G2.exterior |
|
4 |
G1.boundary |
G2.interior |
|
5 |
G1.boundary |
G2.boundary |
|
6 |
G1.boundary |
G2.exterior |
|
7 |
G1.exterior |
G2.interior |
|
8 |
G1.exterior |
G2.boundary |
|
9 |
G1.exterior |
G2.exterior |
In the previous example, relationships 1–3 must be false, relationships 4–6 must be true, and relationships 7–9 are not tested. The truth criteria for any given shape element relationship is that the dimension of intersection between the shape elements is not null. This function does not evaluate the dimension of intersection between the shape elements, whether the intersection exists or not.
Any two shapes exteriors always intersect and the dimension of intersection is 2 (area).
It is not necessary to list G1 and G2 in that order in the syntax. See the following example, if you list G2 first:
"relate (g2, g1, '****T****')"
then simply juxtapose G2 for G1 in the above table, and vice-versa.
- Scenario 1—You have a search area that is a voting district area shape (G1) and you want to find all census blocks that have common adjacent linear boundary (not just a point) and are not inside the voting district. None of the relation words (in, touch, cross, overlap, identical, disjoint) will achieve this result. The voting district and the census blocks you are looking for are area shapes; use the following SCL syntax:
"dim (g1.boundary,g2.boundary) = linear and intersect (g1.interior, g2.interior) = false"
This statement requires that the two shapes must have a co-linear boundary, but their interiors do not intersect.
- Scenario 2—You have a road segment (G1) and want to find all other road segments that connect to it at their mutual end points; use the following syntax:
"G1 touch G2" -or- "g1.boundary intersect g2.boundary"
- Scenario 3—You want to find all shapes that intersect shape G1 and where there is a lack of topological integrity between the two shapes; use the following syntax:
"g1 intersects g2 and topoform = false"
- Scenario 4—You are retrieving all shapes that overlap a window and you want to find all shapes that intersect the interior of area shape G1. These shapes could be point, linear, or area shapes; depending on the G2 shape type the condition may be OVERLAP, CROSS, or IN; use the following syntax:
"g1 overlap g2 or g1 in g2 or g2 in g1 or g2 cross g1"
However, it is a lot easier to use the following syntax instead:
"g1.interior intersects g2"
-or-
"dim (g1.interior, g2) > null"
- Scenario 5—You have a planning zone G1 (area shape) and want to find all land parcels:
Complete or partially inside G1: "dim(g1,interior, g2.interior) = area"
or completely inside G1: "g1 contains g2"
or partially but not completely inside G1: "g2 overlaps g1" - Scenario 6—You are retrieving any and all shapes from a layer for display in a window (G1):
"dim(g1,interior, g2) != null"
-or-
"dim(g1,interior, g2.interior) != null"
-or-
"relate (g1 g2, '****T****')"
-or-
"dim(g1,g2) = dim(g2)"
Shapes can intersect at many different locations and these intersections can occur in different dimensions. Wherever a dimension of intersection is referred to herein, it refers to the maximum dimension of intersection that exists.
The following are SCL keywords and operators:
AND
AREA
BOUNDARY
CONTAIN
CONTAINS
CROSS
CROSSES
DIM
DISJOINT
EQUAL
EQUALS
EXTERIOR
FALSE
G1
G2
IDENTICAL
IN
INSIDE
INTERIOR
INTERSECT
INTERSECTS
INTERSECTION
LINEAR
NIL
NOT
NULL
OR
OVERLAP
OVERLAPS
POINT
TOPOFORM
TOUCH
TOUCHES
TRUE
XOR
Equality operators
The following are equality operators:
- = equality operator, also IDENTICAL operator for shapes
- == equality operator, also IDENTICAL operator for shapes
- != inequality operator, also NON-IDENTICAL operator for shapes
Spatial operators
These operators can be used in place of the actual spatial relation word in the expression of spatial relations (not functions):
- =! DISJOINT operator
- =& OVERLAP operator
- =@ IN operator
- =* TOUCH operator
- =/ CROSS operator
- =? INTERSECT operator
Thus the expression "G1 =? G2" is equivalent to "G1 INTERSECT G2."
Shape comparison language的更多相关文章
- [翻译]Shape comparison language
link: http://www.cnblogs.com/yhlx125/p/3635623.html Shape comparison language 首先说说我遇到的一个问题: IR ...
- [翻译]Shape comparison language[转]
link: http://www.cnblogs.com/yhlx125/p/3635623.html Shape comparison language 首先说说我遇到的一个问题: IR ...
- GIS-006-ArcGIS API 空间关系
Name Description 解释 SPATIAL_REL_CONTAINS Part or all of a feature from feature class 1 is contained ...
- String comparison is too slow in R language
## String comparison is too slow in R language ## it will take 3 minutes, it is too slow date() strA ...
- 机器学习--Classifier comparison
最近在学习机器学习,学习和积累和一些关于机器学习的算法,今天介绍一种机器学习里面各种分类算法的比较 #!/usr/bin/python # -*- coding: utf-8 -*- "&q ...
- 纯Shading Language绘制HTML5时钟
今天是2014年的最后一天,这个时刻总会让人想起时钟,再过几个小时地球人都要再老了一岁,于是搞个HTML5版的时钟就是我们今天要完成的任务,实现HTML5的时钟绘制一般会采用三种方式,第一种采用CSS ...
- [算法]Comparison of the different algorithms for Polygon Boolean operations
Comparison of the different algorithms for Polygon Boolean operations. Michael Leonov 1998 http://w ...
- ActiveMQ, Qpid, HornetQ and RabbitMQ in Comparison
国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html内部邀请码:C8E245J (不写邀请码,没有现金送)国内私 ...
- The 500 Most Commonly Used Words in the English Language
Based on the combined results of British English, American English and Australian English surveys of ...
随机推荐
- PHP面向对象(分页)
<?php class page { var $table; var $pagesize; var $totalsize; var $totalp ...
- DHCP服务器安装及配置
一.什么是DHCP? DHCP (Dynamic Host Configuration protocol)动态主机设置协议,基于UDP(发送很小的数据报文,且对时效性要求较高)协议通信. 它是C/S架 ...
- 在HTML标签<a/>中调用javascript代码
<a/>标签的“href”属性可以是一个有效的URL,表示跳转的目的地,除此之外,href还可以是一段javascript代码.当为“href”设置javascript代码时,格式如下:& ...
- 《Visual C++并行编程实战》译者序
说来凑巧,当开始着手这本书的翻译时,我刚刚入手了自己第一台四核计算机,而翻译工作临近完成之时,我又为自己添置了一台iPad 2(这是一台双核计算机).由此可见,多核计算机已经完全进入了我的日常生活.鉴 ...
- Linux之Qt利用Sqlite静态编译库(转)
参考:http://www.linuxidc.com/Linux/2011-11/47465.htm sqlite3编译安装 ------------------------arm版--------- ...
- 支持向量机(SVM)基础
版权声明: 本文由LeftNotEasy发布于http://leftnoteasy.cnblogs.com, 本文可以被全部的转载或者部分使用,但请注明出处,如果有问题,请联系wheeleast@gm ...
- Mac OS X 上Lua的安装方法
先在Mac OS的终端查询下本机是否已安装Lua Last login: Thu Jul 10 07:54:48 on ttys000 keshans-Mac-mini:~ keshan$ lua - ...
- Jmeter--HTTP Cookie管理器
一.什么情况下需要用到Cookie 一般情况下对于HTTP请求的用户登入操作,需要用到Cookie来模拟用户操作,或者对一些业务只有在用户登入之后才能进行操作,比如:常见的场景有购买商品.下单.支付等 ...
- Flume+Kafka+Strom基于伪分布式环境的结合使用
目录: 一.Flume.Kafka.Storm是什么,如何安装? 二.Flume.Kafka.Storm如何结合使用? 1) 原理是什么? 2) Flume和Kafka的整合 3) Kafka和St ...
- Python 列表
python 列表 列表的特点 1.列表是一种可变的数据类型,这点是跟元组有区别的 2.列表中的值是有序的,并且可存放重复的值,这点跟set有区别的 3.python中的列表类似于其它语言中的数组 4 ...