Sdílet prostřednictvím


Geography Methods Supported by Spatial Indexes

Under certain conditions, spatial indexes support the following set-oriented geography methods: STIntersects(),STEquals(), and STDistance(). To be supported by a spatial index, these methods must be used within the WHERE clause of a query, and they must occur within a predicate of the following general form:

geography1.method_name(geography2)comparison_operatorvalid_number

To return a non-null result, geography1 and geography2 must have the same Spatial Reference Identifier (SRID). Otherwise, the method returns NULL.

Spatial indexes support the following predicate forms:

  • geography1.STIntersects(geography2)= 1

  • geography1.STEquals(geography2)= 1

  • geography1.STDistance(geography2) < number

  • geography1.STDistance(geography2) <= number

    Important

    In either form of STDistance() predicate, at least one of geography arguments (geography1 or geography2) must specify a geography instance that represents a point. Otherwise, the method returns NULL.