O'Reilly logo

Pro Spatial with SQL Server 2012 by Alastair Aitchison

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required