C H A P T E R  12

Testing Spatial Relationships

The key objective for most spatial queries is to try to understand the relationship between two or more features on the Earth in order to answer specific questions: for example, how far is it from a to b? Does the route between x and y pass through z? Does p share a common border with q? In this chapter, I'll introduce the methods that SQL Server provides to answer these questions by comparing different aspects of the relationship between two items of spatial data.

Calculating the Distance Between Two Geometries

The STDistance() method can be used to calculate the shortest distance between any two geometries. When used on instances of the geometry datatype, this is the length of the shortest straight ...

Get Pro Spatial with SQL Server 2012 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.