Performing selections
The previous subsetting example is one way to select data. There are many other ways to subset data for further analysis. In this section, we'll examine some of them.
Point in polygon formula
We briefly discussed the point in polygon formula in Chapter 1, Learning Geospatial Analysis with Python, as a common type of geospatial operation. You'll find that it is one of the most useful formulas out there. The formula is relatively straightforward. The following function performs this check using the Ray Casting method. This method draws a line from the test point all the way through the polygon and counts the number of times it crosses the polygon boundary. If the count is even, the point is outside the polygon. If it is odd, ...
Get Learning Geospatial Analysis with Python - Second 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.