9 Proximity analysis

This chapter covers

  • Nearest neighbor searches
  • K-nearest neighbor (KNN) distance operators
  • Using KNN with geography and geometry
  • Geotagging
  • PostGIS clustering window functions

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? If I need to get at least this much exercise but don’t want to overdo it, how many kale shake joints are between 1K and 2K away from my home? How do I assign visits to my field reps to balance the work? We’ll file all these questions ...

Get PostGIS in Action, Third Edition 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.