Bikeshare stations within a San Francisco buffer
In this example we are going to showcase how easily we can compute buffers around geometries using the Analytics Toolbox.
Creating a buffer of a neighborhood
The following query creates a buffer with a radius of 50 meters around San Francisco’s Financial District neighborhood using the
ST_BUFFER function. The number of steps could be modified in order to make the lines smoother if needed.
In this visualization you can see the Financial Disctrict (darker blue) and its buffer around it. Notice that buffers radius are not necesarily positive numbers. Negative numbers would generate a buffer in the interior of the district’s geomery.
Bikeshare stations within a buffer
Now let’s use the buffer as a way of defining a bigger region around the Financial District of San Francisco and filtering some other geometries.
This query uses the
ST_CONTAINS functions in order to filter those bikeshare stations that are contained inside the buffered geometry. The result is displayed below, where bikeshare stations are represented as yellow dots.