Sometimes the outcome of a predicate is not intuitive, so you should test special cases to make sure you are getting the results
you want. For example, in order for a geometry to contain another geometry (
a.ST_Contains(b)=1), or for a geometry to be within another geometry (
b.ST_Within(a)=1), the interior of a and the interior of b must intersect, and no part of b can intersect the exterior of a. However, there
are some cases where you would expect a geometry to be considered contained or within another geometry, but it is not.
For example, the following return 0 (a is red) for
Case one and two are obvious; the purple geometries are not completely within the red squares. Case three and four, however, are not as obvious. In both of these cases, the purple geometries are only on the boundary of the red squares. ST_Contains does not consider the purple geometries to be within the red squares, even though they appear to be within them.
If your predicate tests return a different result for cases than desired, consider using the ST_Relate method to specify the exact relationship you are testing for. See Test custom relationships using the ST_Relate method.
Discuter à propos de cette page dans DocCommentXchange.
|Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0|