Chapter 10. Proximity analysis

This chapter covers:

Nearest neighbor searches

KNN distance operators

Using KNN with geography


Once you’ve located places with a set of coordinates, questions such as the following arise: How far is my house from the nearest expressway? How many burger joints are within a mile drive? What’s the average distance that people have to commute to work? Which three hospitals closest to me offer emergency vasectomies? We’ll file all these questions under the heading of proximity analysis–loosely, the study of how far something is located from something else.

We’ll cover both the traditional methods of finding closest neighbors as well as newer methods using KNN indexes. Speed is a concern when performing proximity ...

Get PostGIS in Action, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.