I'd like to build a corridor surrounding a polygon, so that the corridor's outer bounds all have the same distance to the inner bounds. Like this:

enter image description here

I've made this lousy graphic in Paint, since I don't even know how this operation is called. I hope you get the idea. To avoid confusion and misplaced suggestions: the outer polygon is NOT a scaled version of the inner. I know I need some transformation for this, I just don't know what kind of.

I'm implementing it in Python, I thought of shapely library, but I'm not sure if that's the one to do it, less so which method might be useful. Thanks in advance

2 Answers 2


The operation your looking for is called buffering, and is a standard function available in most GIS libraries.

In PostGIS/SpatiaLite it's called ST_Buffer(geometry g1, float radius_of_buffer);

In shapely it's called buffer. An example from the shapely docs:

>>> from shapely.geometry import LinearRing, Polygon
>>> coords = [(0, 0), (1, 1), (1, 0)]
>>> r = LinearRing(coords)
>>> s = Polygon(r)
>>> s.area
>>> t = Polygon(s.buffer(1.0).exterior, [r])
>>> t.area

OpenGeo has some great examples of using ST_Buffer

  • AWESOME answer, thank you! Precisely what I wanted ;) Commented May 26, 2014 at 14:35

For users looking for a non-programmatic answer:

You could use QGIS, buffer your polygon and then use difference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.