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
- All point shapes are zero dimensional
- All linear shapes are one dimensional
- All area shapes are two dimensional
- 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.
- 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.
Spatial relationship functions and expressions
- 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.
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.
The following are expression options and examples:
"G1 CROSS G2"
"G1 CROSSS G2"
"G1 =/ G2"
"CROSS (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.
The following are expression options and examples:
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.
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").
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:
"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:
"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:
RELATE is a unary function and is not compared to true or false.
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 |
Any two shapes exteriors always intersect and the dimension of intersection is 2 (area).
"relate (g2, g1, '****T****')"
then simply juxtapose G2 for G1 in the above table, and vice-versa.
- 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:
"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)"
The following are SCL keywords and operators:
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."