In a previous post, I examined creating a bounding box for the 606 trail to enable analysis of surrounding crime. While this is straight forward and a convenient heuristic to explain what we were doing, notice that it’s not fully what we wanted as an area from which to to analyze crimes. Specifically, the bounding box we produced wouldn’t be very good border for investigating crime near the ends of the trail. A better way to address the area would be to use the GIS concept of a buffer, where in this case we’d have an area that looked like a semi-circle on each end of the rectangle of the bounding box. This is relatively easy to accomplish within GIS software such as QGIS.
The downside of this approach is that, while we have a more appropriate take on the area we want to consider, it’s not quite as straight forward to retrieve crimes of interest. With the bounding box approach with SQL, we could just use standard SQL and use the corners of the box as filters to return the crimes of interest. With those curved ends, it’s not quite that easy, but all is not lost if we use GIS features such as those included in the POSTGIS extension of POSTGRES.
In the image below, the buffer is the entire yellow area, whereas the original bounding box is in the dashed line. You can see how the buffer encompasses more area at the ends, which makes sense given our ends. This buffer is about a city block around the trail.
In the following, we can expand this buffer to encompass the area about 2 blocks (about a quarter mile) around the trail. The original bounding box is still dashed, and the previous 1 block buffer is in green. The new 2 block buffer is in light blue.