I was interested in creating mult-ring buffers but with a twist: I didn’t want the buffers to overlap one another. In other words, if I had concentric buffers with distances of 100, 200, and 300 around a point, I want those buffers to reflect distances of 0-100, 100-200, and 200-300. I don’t want them overlapping one another. You can actually do that with the PostGIS function ST_SymDifference, but there are a few nuances that you have to be aware of.
Unlike some of my longer videos, this one will start out with the answer, and then we’ll walk through all the SQL. You’ll see it isn’t so bad. And, you continue to see that spatial is not special!. It’s only 20 minutes long, but the answer is shown in the first minute.
In the video I’ll slowly walk you through all the spatial SQL to create buffers for the points and trim all the overlaps so that there are no overlapping buffers. You’ll learn some really cool Postgres commands including:
ST_Buffer, ST_DifferenceSym, DISTINCT ON, and SET WITH OIDS.
I found myself amazed that with a few SQL tweaks, we were able to turn ordinary buffers to more useful non-overlapping buffers. I hope you enjoy the video.
I’d like to create more videos like that – please leave so comments below so that I know others want me to continue these kinds of tutorials.
If you want to learn more about SQL, programming, open source GIS, or Manifold GIS, check out courses at www.gisadvisor.com.
Comments