跳转至

Geometry buffer(几何缓冲区)

Supported in: Batch, Streaming

Computes the buffer of a geometry for both positive and negative buffer distances. Returns an approximate representation of all points within a given distance of the this geometric object (or for negative buffers, all points minus those within the buffer distance of the boundary). Buffer drops any z coordinates, and zero/negative distance buffers of lines and points will return null.

Expression categories: Geospatial

Declared arguments

  • Buffer distance: The buffer distance in the units of the given projected coordinate system. For single sided geometries a non-positive buffer will result in a null value being returned. For polygonal geometries a negative double-sided buffer will shrink the geometry. For linear or point geometries a non-positive buffer will return null.
    Expression\
  • Geometry column: The geometries to buffer.
    Expression\
  • Projected coordinate system: Projected coordinate system to perform the buffer in, which determines the units of the "buffer distance" parameter. Geometries will be converted to this coordinate system, buffered, then converted back to WGS 84. Formatted as "authority:id", so for example, UTM zone 18N could be identified by EPSG:32618.
    Literal\
  • optional Buffer cap style: The style of the buffer end-caps, defaults to round. If set to flat the end caps are truncated flat at the line ends, while square has the end-caps squared off at the buffer distance beyond the line ends.
    Enum\
  • optional Buffer join style: The style of the buffer joins, defaults to round. Mitre will lead to "sharp" corners, while bevel will lead to corners being beveled (clipped off).
    Enum\
  • optional Line segments per quadrant: For round end-cap and join styles, this defines the number of line segments used to approximate a quarter circle. A sensible default is 8, which gives a maximum error of 2%. Higher values lead to more complex geometries and may degrade performance. Lower values lead to reduced smoothness in the resultant geometry.
    Literal\
  • optional Single or double sided: Whether the buffer is single or double sided. The single sided options work only with linear geometries (line strings and multi-line strings) and positive buffer distances. They result in buffering only the left/right hand side of the geometry, oriented as if traveling along the points of the line from first to last. If a single-sided buffer is selected, non-linear geometries (polygons and points) will be dropped.
    Enum\

Output type: Geometry

Examples

Example 1: Base case

Argument values:

  • Buffer distance: distance
  • Geometry column: geometry
  • Projected coordinate system: EPSG:32618
  • Buffer cap style: ROUND
  • Buffer join style: ROUND
  • Line segments per quadrant: 8
  • Single or double sided: DOUBLE_SIDED
geometry distance Output
{"type":"Point","coordinates":[-77.07368071728229,38.83040844313318]} 10.0 {"type":"Polygon","coordinates":[[[-77.07356558299462, 38.83041048767274],[-77.07356728534256, 38.83...
{"type":"LineString","coordinates":[[-77.07368071728229,38.83040844313318, 1],[-77.0725293738795,38.83042888342659, 1]]} 10.0 {"type":"Polygon","coordinates":[[[-77.07253198637027, 38.83051894052714],[-77.07250947453703, 38.83...
{"type":"Polygon","coordinates":[[[-77.07368071728229,38.83040844313318, 1],[-77.0725293738795,38.83... 10.0 {"type":"Polygon","coordinates":[[[-77.07379585155829, 38.83040639848026],[-77.07382199292853, 38.83...

Example 2: Base case

Argument values:

  • Buffer distance: distance
  • Geometry column: geometry
  • Projected coordinate system: EPSG:32618
  • Buffer cap style: ROUND
  • Buffer join style: ROUND
  • Line segments per quadrant: 8
  • Single or double sided: DOUBLE_SIDED
geometry distance Output
{"type":"Point","coordinates":[-77.07368071728229,38.83040844313318]} -1.0 null
{"type":"LineString","coordinates":[[-77.07368071728229,38.83040844313318],[-77.0725293738795,38.83042888342659]]} -1.0 null
{"type":"Polygon","coordinates":[[[-77.07368071728229,38.83040844313318],[-77.07370685720375,38.83130901341597],[-77.0725293738795,38.83042888342659],[-77.07368071728229,38.83040844313318]]]} -1.0 {"type":"Polygon","coordinates":[[[-77.07366946524603, 38.830417653295896],[-77.07369471254682, 38.83128747619332],[-77.07255743103391, 38.83043739579778],[-77.07366946524603, 38.830417653295896]]]}
{"type":"Polygon","coordinates":[[[-77.07331719760555, 38.83072458211154],[-77.07331719760555, 38.83... -500.0 null

Example 3: Base case

Argument values:

  • Buffer distance: distance
  • Geometry column: geometry
  • Projected coordinate system: EPSG:32618
  • Buffer cap style: ROUND
  • Buffer join style: ROUND
  • Line segments per quadrant: 8
  • Single or double sided: SINGLE_SIDED_LEFT
geometry distance Output
{"type":"LineString","coordinates":[[-77.07368071728229,38.83040844313318],[-77.0725293738795,38.83042888342659]]} 5.0 {"type":"Polygon","coordinates":[[[-77.0725293738795, 38.83042888342659],[-77.07368071728229, 38.830...
{"type":"Polygon","coordinates":[[[-77.0725293738795, 38.83042888342659],[-77.07368071728229, 38.830... 5.0 null
{"type":"Point","coordinates": [-77.0725293738795, 38.83042888342659]]} 5.0 null

Example 4: Base case

Argument values:

  • Buffer distance: distance
  • Geometry column: geometry
  • Projected coordinate system: EPSG:32618
  • Buffer cap style: ROUND
  • Buffer join style: ROUND
  • Line segments per quadrant: 8
  • Single or double sided: SINGLE_SIDED_RIGHT
geometry distance Output
{"type":"LineString","coordinates":[[-77.07368071728229,38.83040844313318],[-77.0725293738795,38.83042888342659]]} 5.0 {"type":"Polygon","coordinates":[[[-77.07368071728229, 38.83040844313318],[-77.0725293738795, 38.830...

Example 5: Null case

Argument values:

  • Buffer distance: distance
  • Geometry column: geometry
  • Projected coordinate system: EPSG:32618
  • Buffer cap style: ROUND
  • Buffer join style: ROUND
  • Line segments per quadrant: 8
  • Single or double sided: DOUBLE_SIDED
geometry distance Output
null 10.0 null

Example 6: Null case

Argument values:

  • Buffer distance: distance
  • Geometry column: geometry
  • Projected coordinate system: EPSG:32618
  • Buffer cap style: ROUND
  • Buffer join style: ROUND
  • Line segments per quadrant: 8
  • Single or double sided: SINGLE_SIDED_LEFT
geometry distance Output
{"type": "GeometryCollection","geometries": [{"type":"LineString","coordinates":[[-77.0736807172822... 5.0 {"type":"Polygon","coordinates":[[[-77.0725293738795, 38.83042888342659],[-77.07368071728229, 38.830...

Example 7: Edge case

Argument values:

  • Buffer distance: distance
  • Geometry column: geometry
  • Projected coordinate system: EPSG:32618
  • Buffer cap style: ROUND
  • Buffer join style: BEVEL
  • Line segments per quadrant: 8
  • Single or double sided: DOUBLE_SIDED
geometry distance Output
{"type":"Polygon","coordinates":[[[-77.07368071728229,38.83040844313318],[-77.0725293738795,38.83042888342659],[-77.07370685720375,38.83130901341597],[-77.07368071728229,38.83040844313318]]]} 5.0 {"type":"Polygon","coordinates":[[[-77.07373828442175, 38.83040742082089],[-77.0737644250676, 38.831...

Example 8: Edge case

Argument values:

  • Buffer distance: distance
  • Geometry column: geometry
  • Projected coordinate system: EPSG:32618
  • Buffer cap style: FLAT
  • Buffer join style: ROUND
  • Line segments per quadrant: 8
  • Single or double sided: DOUBLE_SIDED
geometry distance Output
{"type":"LineString","coordinates":[[-77.07368071728229,38.83040844313318],[-77.0725293738795,38.83042888342659]]} 5.0 {"type":"Polygon","coordinates":[[[-77.07253068012344, 38.830473911977066],[-77.07252806763852, 38.8...

Example 9: Edge case

Argument values:

  • Buffer distance: distance
  • Geometry column: geometry
  • Projected coordinate system: EPSG:32618
  • Buffer cap style: ROUND
  • Buffer join style: ROUND
  • Line segments per quadrant: 12
  • Single or double sided: DOUBLE_SIDED
geometry distance Output
{"type":"Point","coordinates":[-77.07368071728229,38.83040844313318]} 10.0 {"type":"Polygon","coordinates":[[[-77.07356558299462, 38.83041048767274],[-77.0735662268165, 38.830...

Example 10: Edge case

Argument values:

  • Buffer distance: distance
  • Geometry column: geometry
  • Projected coordinate system: EPSG:32618
  • Buffer cap style: ROUND
  • Buffer join style: MITRE
  • Line segments per quadrant: 8
  • Single or double sided: DOUBLE_SIDED
geometry distance Output
{"type":"Polygon","coordinates":[[[-77.07373697742014, 38.830362392304345],[-77.07376758060177, 38.83141669950616],[-77.072389088204, 38.83038632146655],[-77.07373697742014, 38.830362392304345]]]} 5.0 {"type":"Polygon","coordinates":[[[-77.07379323748556, 38.830316341450036],[-77.0738283041888, 38.83152438555785],[-77.07224880268927, 38.83034375933304],[-77.07379323748556, 38.830316341450036]]]}

Example 11: Edge case

Argument values:

  • Buffer distance: distance
  • Geometry column: geometry
  • Projected coordinate system: EPSG:32618
  • Buffer cap style: ROUND
  • Buffer join style: ROUND
  • Line segments per quadrant: 8
  • Single or double sided: SINGLE_SIDED_LEFT
geometry distance Output
{"type":"Point","coordinates":[-77.07368071728229,38.83040844313318]} -1.0 null
{"type":"LineString","coordinates":[[-77.07368071728229,38.83040844313318],[-77.0725293738795,38.83042888342659]]} -1.0 null
{"type":"Polygon","coordinates":[[[-77.07368071728229,38.83040844313318],[-77.07370685720375,38.83130901341597],[-77.0725293738795,38.83042888342659],[-77.07368071728229,38.83040844313318]]]} -1.0 null

Example 12: Edge case

Argument values:

  • Buffer distance: distance
  • Geometry column: geometry
  • Projected coordinate system: EPSG:32618
  • Buffer cap style: SQUARE
  • Buffer join style: ROUND
  • Line segments per quadrant: 8
  • Single or double sided: DOUBLE_SIDED
geometry distance Output
{"type":"LineString","coordinates":[[-77.07368071728229,38.83040844313318],[-77.0725293738795,38.83042888342659]]} 5.0 {"type":"Polygon","coordinates":[[[-77.07253068012344, 38.830473911977066],[-77.0724731128864, 38.83...

Example 13: Edge case

Argument values:

  • Buffer distance: distance
  • Geometry column: geometry
  • Projected coordinate system: EPSG:32618
  • Buffer cap style: ROUND
  • Buffer join style: ROUND
  • Line segments per quadrant: 8
  • Single or double sided: DOUBLE_SIDED
geometry distance Output
{"type":"Point","coordinates":[-77.07368071728229,38.83040844313318]} 0.0 null
{"type":"LineString","coordinates":[[-77.07368071728229,38.83040844313318],[-77.0725293738795,38.83042888342659]]} 0.0 null
{"type":"Polygon","coordinates":[[[-77.07368071728229,38.83040844313318],[-77.07370685720375,38.83130901341597],[-77.0725293738795,38.83042888342659],[-77.07368071728229,38.83040844313318]]]} 0.0 {"type":"Polygon","coordinates":[[[-77.07368071728229,38.83040844313318],[-77.07370685720375,38.83130901341597],[-77.0725293738795,38.83042888342659],[-77.07368071728229,38.83040844313318]]]}


中文翻译

几何缓冲区

支持:批处理、流式处理

计算几何体的缓冲区,支持正负缓冲区距离。返回该几何对象指定距离内所有点的近似表示(对于负缓冲区,则返回所有点减去边界缓冲区距离内的点)。缓冲区会丢弃所有 z 坐标,线和点的零距离或负距离缓冲区将返回 null。

表达式类别: 地理空间

声明的参数

  • 缓冲区距离: 以给定投影坐标系单位为单位的缓冲区距离。对于单侧几何体,非正缓冲区将返回 null。对于多边形几何体,负的双侧缓冲区将缩小几何体。对于线或点几何体,非正缓冲区将返回 null。
    表达式\
  • 几何列: 要进行缓冲的几何体。
    表达式\
  • 投影坐标系: 执行缓冲操作的投影坐标系,决定了"缓冲区距离"参数的单位。几何体将被转换为此坐标系,进行缓冲,然后再转换回 WGS 84。格式为"authority:id",例如,UTM 18N 区可标识为 EPSG:32618。
    字面量\
  • 可选 缓冲区端点样式: 缓冲区端点的样式,默认为圆形。如果设置为平头,则端点在线末端被截平;而方头则使端点在线末端超出缓冲区距离处呈方形。
    枚举\<平头, 圆形, 方头>
  • 可选 缓冲区连接样式: 缓冲区连接的样式,默认为圆形。斜接将产生"尖锐"的角,而斜角将导致角被斜切(剪掉)。
    枚举\<斜角, 斜接, 圆形>
  • 可选 每象限线段数: 对于圆形端点和连接样式,此参数定义用于近似四分之一圆的线段数量。合理的默认值为 8,最大误差为 2%。较高的值会导致几何体更复杂,并可能降低性能。较低的值会降低结果几何体的平滑度。
    字面量\
  • 可选 单侧或双侧: 缓冲区是单侧还是双侧。单侧选项仅适用于线几何体(线串和多线串)以及正缓冲区距离。它们仅对几何体的左侧/右侧进行缓冲,方向如同沿着线的点从第一个到最后一个行进。如果选择了单侧缓冲区,非线几何体(多边形和点)将被丢弃。
    枚举\<双侧, 单侧:左侧, 单侧:右侧>

输出类型: 几何体

示例

示例 1:基本情况

参数值:

  • 缓冲区距离: distance
  • 几何列: geometry
  • 投影坐标系: EPSG:32618
  • 缓冲区端点样式: ROUND
  • 缓冲区连接样式: ROUND
  • 每象限线段数: 8
  • 单侧或双侧: DOUBLE_SIDED
geometry distance 输出
{"type":"Point","coordinates":[-77.07368071728229,38.83040844313318]} 10.0 {"type":"Polygon","coordinates":[[[-77.07356558299462, 38.83041048767274],[-77.07356728534256, 38.83...
{"type":"LineString","coordinates":[[-77.07368071728229,38.83040844313318, 1],[-77.0725293738795,38.83042888342659, 1]]} 10.0 {"type":"Polygon","coordinates":[[[-77.07253198637027, 38.83051894052714],[-77.07250947453703, 38.83...
{"type":"Polygon","coordinates":[[[-77.07368071728229,38.83040844313318, 1],[-77.0725293738795,38.83... 10.0 {"type":"Polygon","coordinates":[[[-77.07379585155829, 38.83040639848026],[-77.07382199292853, 38.83...

示例 2:基本情况

参数值:

  • 缓冲区距离: distance
  • 几何列: geometry
  • 投影坐标系: EPSG:32618
  • 缓冲区端点样式: ROUND
  • 缓冲区连接样式: ROUND
  • 每象限线段数: 8
  • 单侧或双侧: DOUBLE_SIDED
geometry distance 输出
{"type":"Point","coordinates":[-77.07368071728229,38.83040844313318]} -1.0 null
{"type":"LineString","coordinates":[[-77.07368071728229,38.83040844313318],[-77.0725293738795,38.83042888342659]]} -1.0 null
{"type":"Polygon","coordinates":[[[-77.07368071728229,38.83040844313318],[-77.07370685720375,38.83130901341597],[-77.0725293738795,38.83042888342659],[-77.07368071728229,38.83040844313318]]]} -1.0 {"type":"Polygon","coordinates":[[[-77.07366946524603, 38.830417653295896],[-77.07369471254682, 38.83128747619332],[-77.07255743103391, 38.83043739579778],[-77.07366946524603, 38.830417653295896]]]}
{"type":"Polygon","coordinates":[[[-77.07331719760555, 38.83072458211154],[-77.07331719760555, 38.83... -500.0 null

示例 3:基本情况

参数值:

  • 缓冲区距离: distance
  • 几何列: geometry
  • 投影坐标系: EPSG:32618
  • 缓冲区端点样式: ROUND
  • 缓冲区连接样式: ROUND
  • 每象限线段数: 8
  • 单侧或双侧: SINGLE_SIDED_LEFT
geometry distance 输出
{"type":"LineString","coordinates":[[-77.07368071728229,38.83040844313318],[-77.0725293738795,38.83042888342659]]} 5.0 {"type":"Polygon","coordinates":[[[-77.0725293738795, 38.83042888342659],[-77.07368071728229, 38.830...
{"type":"Polygon","coordinates":[[[-77.0725293738795, 38.83042888342659],[-77.07368071728229, 38.830... 5.0 null
{"type":"Point","coordinates": [-77.0725293738795, 38.83042888342659]]} 5.0 null

示例 4:基本情况

参数值:

  • 缓冲区距离: distance
  • 几何列: geometry
  • 投影坐标系: EPSG:32618
  • 缓冲区端点样式: ROUND
  • 缓冲区连接样式: ROUND
  • 每象限线段数: 8
  • 单侧或双侧: SINGLE_SIDED_RIGHT
geometry distance 输出
{"type":"LineString","coordinates":[[-77.07368071728229,38.83040844313318],[-77.0725293738795,38.83042888342659]]} 5.0 {"type":"Polygon","coordinates":[[[-77.07368071728229, 38.83040844313318],[-77.0725293738795, 38.830...

示例 5:空值情况

参数值:

  • 缓冲区距离: distance
  • 几何列: geometry
  • 投影坐标系: EPSG:32618
  • 缓冲区端点样式: ROUND
  • 缓冲区连接样式: ROUND
  • 每象限线段数: 8
  • 单侧或双侧: DOUBLE_SIDED
geometry distance 输出
null 10.0 null

示例 6:空值情况

参数值:

  • 缓冲区距离: distance
  • 几何列: geometry
  • 投影坐标系: EPSG:32618
  • 缓冲区端点样式: ROUND
  • 缓冲区连接样式: ROUND
  • 每象限线段数: 8
  • 单侧或双侧: SINGLE_SIDED_LEFT
geometry distance 输出
{"type": "GeometryCollection","geometries": [{"type":"LineString","coordinates":[[-77.0736807172822... 5.0 {"type":"Polygon","coordinates":[[[-77.0725293738795, 38.83042888342659],[-77.07368071728229, 38.830...

示例 7:边界情况

参数值:

  • 缓冲区距离: distance
  • 几何列: geometry
  • 投影坐标系: EPSG:32618
  • 缓冲区端点样式: ROUND
  • 缓冲区连接样式: BEVEL
  • 每象限线段数: 8
  • 单侧或双侧: DOUBLE_SIDED
geometry distance 输出
{"type":"Polygon","coordinates":[[[-77.07368071728229,38.83040844313318],[-77.0725293738795,38.83042888342659],[-77.07370685720375,38.83130901341597],[-77.07368071728229,38.83040844313318]]]} 5.0 {"type":"Polygon","coordinates":[[[-77.07373828442175, 38.83040742082089],[-77.0737644250676, 38.831...

示例 8:边界情况

参数值:

  • 缓冲区距离: distance
  • 几何列: geometry
  • 投影坐标系: EPSG:32618
  • 缓冲区端点样式: FLAT
  • 缓冲区连接样式: ROUND
  • 每象限线段数: 8
  • 单侧或双侧: DOUBLE_SIDED
geometry distance 输出
{"type":"LineString","coordinates":[[-77.07368071728229,38.83040844313318],[-77.0725293738795,38.83042888342659]]} 5.0 {"type":"Polygon","coordinates":[[[-77.07253068012344, 38.830473911977066],[-77.07252806763852, 38.8...

示例 9:边界情况

参数值:

  • 缓冲区距离: distance
  • 几何列: geometry
  • 投影坐标系: EPSG:32618
  • 缓冲区端点样式: ROUND
  • 缓冲区连接样式: ROUND
  • 每象限线段数: 12
  • 单侧或双侧: DOUBLE_SIDED
geometry distance 输出
{"type":"Point","coordinates":[-77.07368071728229,38.83040844313318]} 10.0 {"type":"Polygon","coordinates":[[[-77.07356558299462, 38.83041048767274],[-77.0735662268165, 38.830...

示例 10:边界情况

参数值:

  • 缓冲区距离: distance
  • 几何列: geometry
  • 投影坐标系: EPSG:32618
  • 缓冲区端点样式: ROUND
  • 缓冲区连接样式: MITRE
  • 每象限线段数: 8
  • 单侧或双侧: DOUBLE_SIDED
geometry distance 输出
{"type":"Polygon","coordinates":[[[-77.07373697742014, 38.830362392304345],[-77.07376758060177, 38.83141669950616],[-77.072389088204, 38.83038632146655],[-77.07373697742014, 38.830362392304345]]]} 5.0 {"type":"Polygon","coordinates":[[[-77.07379323748556, 38.830316341450036],[-77.0738283041888, 38.83152438555785],[-77.07224880268927, 38.83034375933304],[-77.07379323748556, 38.830316341450036]]]}

示例 11:边界情况

参数值:

  • 缓冲区距离: distance
  • 几何列: geometry
  • 投影坐标系: EPSG:32618
  • 缓冲区端点样式: ROUND
  • 缓冲区连接样式: ROUND
  • 每象限线段数: 8
  • 单侧或双侧: SINGLE_SIDED_LEFT
geometry distance 输出
{"type":"Point","coordinates":[-77.07368071728229,38.83040844313318]} -1.0 null
{"type":"LineString","coordinates":[[-77.07368071728229,38.83040844313318],[-77.0725293738795,38.83042888342659]]} -1.0 null
{"type":"Polygon","coordinates":[[[-77.07368071728229,38.83040844313318],[-77.07370685720375,38.83130901341597],[-77.0725293738795,38.83042888342659],[-77.07368071728229,38.83040844313318]]]} -1.0 null

示例 12:边界情况

参数值:

  • 缓冲区距离: distance
  • 几何列: geometry
  • 投影坐标系: EPSG:32618
  • 缓冲区端点样式: SQUARE
  • 缓冲区连接样式: ROUND
  • 每象限线段数: 8
  • 单侧或双侧: DOUBLE_SIDED
geometry distance 输出
{"type":"LineString","coordinates":[[-77.07368071728229,38.83040844313318],[-77.0725293738795,38.83042888342659]]} 5.0 {"type":"Polygon","coordinates":[[[-77.07253068012344, 38.830473911977066],[-77.0724731128864, 38.83...

示例 13:边界情况

参数值:

  • 缓冲区距离: distance
  • 几何列: geometry
  • 投影坐标系: EPSG:32618
  • 缓冲区端点样式: ROUND
  • 缓冲区连接样式: ROUND
  • 每象限线段数: 8
  • 单侧或双侧: DOUBLE_SIDED
geometry distance 输出
{"type":"Point","coordinates":[-77.07368071728229,38.83040844313318]} 0.0 null
{"type":"LineString","coordinates":[[-77.07368071728229,38.83040844313318],[-77.0725293738795,38.83042888342659]]} 0.0 null
{"type":"Polygon","coordinates":[[[-77.07368071728229,38.83040844313318],[-77.07370685720375,38.83130901341597],[-77.0725293738795,38.83042888342659],[-77.07368071728229,38.83040844313318]]]} 0.0 {"type":"Polygon","coordinates":[[[-77.07368071728229,38.83040844313318],[-77.07370685720375,38.83130901341597],[-77.0725293738795,38.83042888342659],[-77.07368071728229,38.83040844313318]]]}