Expanding Polygon by distance using PostGIS?

by Marc Compte   Last Updated January 11, 2019 12:22 PM

I am trying to expand a polygon in a particular manner with PostGIS. I need a new geometry that is a bit like a Buffer, except Buffer produces rounded corners (lots of vertices) when using it on a square and I need a new square whose sides are N meters away from the inner/original square (and still have only 4 vertices).

My first approach was to use a Buffer and then Simplify, but that is not producing the desired result.

I checked ST_Expand but this returns a BBOX, so it does not work either when the square is not perfectly N-S/E-W oriented nor will it work on irregular polygons.

I also looked into ST_Scale, but this uses a multiplying factor which I don't know how to find out based on a metric distance.

Another function I've looked into is ST_Affine to see if I can scale and translate in one go, but I got no clue how to find out the values I should use in this function.

I have searched and found out nothing. Has anyone done this with PostGIS? then, how?

Tags : postgis polygon


Related Questions


Point within a Polygon within another Polygon

Updated December 11, 2017 10:22 AM

STContains on SQL Server vs ST_Contains on PostGIS

Updated January 13, 2018 09:22 AM


Split Lines by Polygons

Updated February 24, 2017 17:22 PM