5. Geospatial Functions : Buffer
 
Share this page                  
Buffer
BUFFER(g Geometry, n float)
Alias: ST_BUFFER
Returns an object that contains g and every point that has a distance equal to or less than n from g.
Result type: geometry
Example:
SELECT ASTEXT(BUFFER(POLYFROMTEXT('POLYGON((0 0, 0 20, 15 20, 15 0, 0 0))'), 1));
--------------------------------
col1
--------------------------------
POLYGON ((0 -1, -0.1950903220161339 -0.9807852804032293, -0.3826834323650944 -0.9238795325112849, -0.5555702330196058 -0.8314696123025428, -0.7071067811865498 -0.7071067811865452, -0.8314696123025467 -0.5555702330196001, -0.9238795325112873 -0.3826834323650884, -0.9807852804032307 -0.1950903220161275, -1 0, -1 20, -0.9807852804032304 20.195090322016128, -0.9238795325112867 20.3826834323650914, -0.8314696123025453 20.5555702330196013, -0.7071067811865475 20.7071067811865461, -0.555570233019602 20.8314696123025449, -0.3826834323650897 20.9238795325112861, -0.1950903220161282 20.9807852804032322, 0 21, 15 21, 15.195090322016128 20.9807852804032322, 15.3826834323650896 20.9238795325112861, 15.5555702330196031 20.8314696123025449, 15.7071067811865479 20.7071067811865461, 15.8314696123025449 20.5555702330196013, 15.9238795325112861 20.3826834323650914, 15.9807852804032304 20.195090322016128, 16 20, 16 0, 15.9807852804032304 -0.1950903220161282, 15.9238795325112861 -0.3826834323650898, 15.8314696123025449 -0.5555702330196022, 15.7071067811865479 -0.7071067811865475, 15.5555702330196031 -0.8314696123025452, 15.3826834323650896 -0.9238795325112867, 15.195090322016128 -0.9807852804032304, 15 -1, 0 -1))
---------------------------------