Spacial Data in SQL Server
It’s not very often which you deal with spacial data in SQL. In fact, I find it to be a very rare occurrence, but when it does happen, it’s nice to know that there are two libraries for it: geometry (which is for Euclidean Geometry) and geography (which uses lat/long, and takes into account the curvature of the earth).
geometrywe can generate a series of shapes based on the district, and given a lat/long of a house, find out which district the house is in.
geometry, you can declare a point with the target location at it’s center, and declare a buffer area. This will build a shape of a circle you can use and simply check for a collision inside the circle. In other systems, this would require much more effort. Including trig mathematics.
geometrymakes dealing with spacial data, a task that is normally extremely difficult, very easy.