Skip to content

Instantly share code, notes, and snippets.

@AlexArcPy
Created March 23, 2018 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexArcPy/8e204a8faa8c401665470a2647dec99e to your computer and use it in GitHub Desktop.
Save AlexArcPy/8e204a8faa8c401665470a2647dec99e to your computer and use it in GitHub Desktop.
Multiple Ring Buffer with PostGIS
--using set returning function generate_series
--https://www.postgresql.org/docs/9.1/static/functions-srf.html
WITH buffer_values as (
SELECT * FROM generate_series(5, 20, 5) AS dist
)
SELECT
CAST(p.id AS INT), p.name, b.dist, ST_Buffer(p.geom, b.dist) AS Poly
FROM
nyc_subway_stations p
CROSS JOIN
buffer_values b
WHERE
p.id < 10
ORDER BY
p.id, b.dist;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment