跳转至

Simplify geometry(简化几何图形(Simplify geometry))

Supported in: Batch, Faster, Streaming

This expression simplifies GeoJSON geometry by removing points within the given tolerance distance using a spherical model of the globe. Loops smaller than the tolerance may be removed entirely.

Expression categories: Geospatial

Declared arguments

  • Geometry: Valid GeoJSON geometry.
    Expression\
  • Tolerance: Tolerance (meters).
    Expression\
  • optional Coordinate precision: Maximum number of decimal places for coordinates (defaults to 6 decimal places).
    Expression\

Output type: Geometry

Examples

Example 1: Base case

Argument values:

  • Geometry: Geometry
  • Tolerance: Tolerance
  • Coordinate precision: null
Geometry Tolerance Output
{"type":"LineString","coordinates":[[30.0,0.0],[35.0,0.0],[40.0,0.0]]} 1000 {"type":"LineString","coordinates":[[30.0,0.0],[40.0,0.0]]}
{"type":"Polygon","coordinates":[[[-1.0,-1.0],[1.0,-1.0],[1.0,1.0],[0.0,1.0],[-1.0,1.0],[-1.0,-1.0]]]} 12000 {"type":"Polygon","coordinates":[[[-1.0,1.0],[1.0,1.0],[1.0,-1.0],[-1.0,-1.0],[-1.0,1.0]]]}
{"type":"MultiLineString","coordinates":[[[0.0,0.0],[5.0,0.1],[10.0,0.0]], [[0.0,-5.0],[5.0,0.1],[10.0,5.0]]]} 12000 {"type":"MultiLineString","coordinates":[[[0.0,0.0],[10.0,0.0]],[[0.0,-5.0],[10.0,5.0]]]}
{"type":"MultiPolygon","coordinates":[[[[-2.0,-2.0],[2.0,-2.0],[2.0,2.0],[0.0,2.1],[-2.0,2.0],[-2.0,... 12000 {"type":"MultiPolygon","coordinates":[[[[-2.0,2.0],[2.0,2.0],[2.0,-2.0],[-2.0,-2.0],[-2.0,2.0]], [[1...

Example 2: Base case

Argument values:

  • Geometry: Geometry
  • Tolerance: Tolerance
  • Coordinate precision: Coordinate precision
Geometry Tolerance Coordinate precision Output
{"type":"Polygon","coordinates":[[[-1.012345,-1.0],[1.012345,-1.0],[1.012345,1.0],[0.0,1.0],[-1.012345,1.0],[-1.012345,-1.0]]]} 12000 3 {"type":"Polygon","coordinates":[[[-1.012,1.0],[1.012,1.0],[1.012,-1.0],[-1.012,-1.0],[-1.012,1.0]]]}
{"type":"Polygon","coordinates":[[[-1.0123456789,-1.0],[1.0123456789,-1.0],[1.0123456789,1.0],[0.0,1.0],[-1.0123456789,1.0],[-1.0123456789,-1.0]]]} 12000 6 {"type":"Polygon","coordinates":[[[-1.012346,1.0],[1.012346,1.0],[1.012346,-1.0],[-1.012346,-1.0],[-1.012346,1.0]]]}
{"type":"Polygon","coordinates":[[[-1.0123456789,-1.0],[1.0123456789,-1.0],[1.0123456789,1.0],[0.0,1.0],[-1.0123456789,1.0],[-1.0123456789,-1.0]]]} 12000 10 {"type":"Polygon","coordinates":[[[-1.0123456789,1.0],[1.0123456789,1.0],[1.0123456789,-1.0],[-1.0123456789,-1.0],[-1.0123456789,1.0]]]}

Example 3: Null case

Argument values:

  • Geometry: Geometry
  • Tolerance: Tolerance
  • Coordinate precision: null
Geometry Tolerance Output
null 0 null

Example 4: Edge case

Argument values:

  • Geometry: Geometry
  • Tolerance: Tolerance
  • Coordinate precision: Coordinate precision
Geometry Tolerance Coordinate precision Output
{"type":"Polygon","coordinates":[[[-1.0,-1.0],[1.0,-1.0],[1.0,1.0],[0.0,1.0],[-1.0,1.0],[-1.0,-1.0]]]} 200000 3 null
{"type":"Polygon","coordinates":[[[-1.0,-1.0],[1.0,-1.0],[1.0,1.0],[0.0,1.0],[-1.0,1.0],[-1.0,-1.0]],[[5.0,0.0],[10.0,0.0],[10.0,5.0],[5.0,5.0],[5.0,0.0]]]} 200000 3 {"type":"Polygon","coordinates":[[[10.0, 5.0], [10.0, 0.0], [5.0, 0.0], [5.0, 5.0], [10.0, 5.0]]]}
{"type":"MultiPolygon","coordinates":[[[[-1.0,-1.0],[1.0,-1.0],[1.0,1.0],[0.0,1.0],[-1.0,1.0],[-1.0,-1.0]]],[[[5.0,0.0],[10.0,0.0],[10.0,5.0],[5.0,5.0],[5.0,0.0]]]]} 200000 3 {"coordinates":[[[10.0, 5.0], [10.0, 0.0], [5.0, 0.0], [5.0, 5.0], [10.0, 5.0]]], "type":"Polygon"}
{"type":"MultiPolygon","coordinates":[[[[-1.0,-1.0],[1.0,-1.0],[1.0,1.0],[0.0,1.0],[-1.0,1.0],[-1.0,-1.0]]],[[[5.0,0.0],[10.0,0.0],[10.0,5.0],[5.0,5.0],[5.0,0.0]]]]} 500000 3 null
{"type":"GeometryCollection","geometries":[{"type":"MultiLineString","coordinates":[[[0.0,0.0],[5.0,... 500000 3 {"type":"GeometryCollection","geometries":[{"type":"MultiLineString","coordinates":[[[0.0, 0.0], [10.0, 0.0]], [[0.0, -5.0],[10.0, 5.0]]]}]}
{"type":"GeometryCollection","geometries":[{"type":"Polygon","coordinates":[[[-1.0,-1.0],[1.0,-1.0],... 500000 3 null


中文翻译

简化几何图形(Simplify geometry)

支持:批处理(Batch)、快速处理(Faster)、流处理(Streaming)

该表达式通过使用球体模型,移除给定容差距离内的点来简化GeoJSON几何图形。小于容差范围的环可能被完全移除。

表达式类别: 地理空间(Geospatial)

声明参数(Declared arguments)

  • 几何图形(Geometry): 有效的GeoJSON几何图形。
    表达式\
  • 容差(Tolerance): 容差(单位:米)。
    表达式\
  • 可选 坐标精度(Coordinate precision): 坐标的最大小数位数(默认为6位小数)。
    表达式\

输出类型: Geometry

示例(Examples)

示例1:基本情况(Base case)

参数值:

  • 几何图形(Geometry): Geometry
  • 容差(Tolerance): Tolerance
  • 坐标精度(Coordinate precision): null
Geometry Tolerance 输出(Output)
{"type":"LineString","coordinates":[[30.0,0.0],[35.0,0.0],[40.0,0.0]]} 1000 {"type":"LineString","coordinates":[[30.0,0.0],[40.0,0.0]]}
{"type":"Polygon","coordinates":[[[-1.0,-1.0],[1.0,-1.0],[1.0,1.0],[0.0,1.0],[-1.0,1.0],[-1.0,-1.0]]]} 12000 {"type":"Polygon","coordinates":[[[-1.0,1.0],[1.0,1.0],[1.0,-1.0],[-1.0,-1.0],[-1.0,1.0]]]}
{"type":"MultiLineString","coordinates":[[[0.0,0.0],[5.0,0.1],[10.0,0.0]], [[0.0,-5.0],[5.0,0.1],[10.0,5.0]]]} 12000 {"type":"MultiLineString","coordinates":[[[0.0,0.0],[10.0,0.0]],[[0.0,-5.0],[10.0,5.0]]]}
{"type":"MultiPolygon","coordinates":[[[[-2.0,-2.0],[2.0,-2.0],[2.0,2.0],[0.0,2.1],[-2.0,2.0],[-2.0,... 12000 {"type":"MultiPolygon","coordinates":[[[[-2.0,2.0],[2.0,2.0],[2.0,-2.0],[-2.0,-2.0],[-2.0,2.0]], [[1...

示例2:基本情况(Base case)

参数值:

  • 几何图形(Geometry): Geometry
  • 容差(Tolerance): Tolerance
  • 坐标精度(Coordinate precision): Coordinate precision
Geometry Tolerance Coordinate precision 输出(Output)
{"type":"Polygon","coordinates":[[[-1.012345,-1.0],[1.012345,-1.0],[1.012345,1.0],[0.0,1.0],[-1.012345,1.0],[-1.012345,-1.0]]]} 12000 3 {"type":"Polygon","coordinates":[[[-1.012,1.0],[1.012,1.0],[1.012,-1.0],[-1.012,-1.0],[-1.012,1.0]]]}
{"type":"Polygon","coordinates":[[[-1.0123456789,-1.0],[1.0123456789,-1.0],[1.0123456789,1.0],[0.0,1.0],[-1.0123456789,1.0],[-1.0123456789,-1.0]]]} 12000 6 {"type":"Polygon","coordinates":[[[-1.012346,1.0],[1.012346,1.0],[1.012346,-1.0],[-1.012346,-1.0],[-1.012346,1.0]]]}
{"type":"Polygon","coordinates":[[[-1.0123456789,-1.0],[1.0123456789,-1.0],[1.0123456789,1.0],[0.0,1.0],[-1.0123456789,1.0],[-1.0123456789,-1.0]]]} 12000 10 {"type":"Polygon","coordinates":[[[-1.0123456789,1.0],[1.0123456789,1.0],[1.0123456789,-1.0],[-1.0123456789,-1.0],[-1.0123456789,1.0]]]}

示例3:空值情况(Null case)

参数值:

  • 几何图形(Geometry): Geometry
  • 容差(Tolerance): Tolerance
  • 坐标精度(Coordinate precision): null
Geometry Tolerance 输出(Output)
null 0 null

示例4:边界情况(Edge case)

参数值:

  • 几何图形(Geometry): Geometry
  • 容差(Tolerance): Tolerance
  • 坐标精度(Coordinate precision): Coordinate precision
Geometry Tolerance Coordinate precision 输出(Output)
{"type":"Polygon","coordinates":[[[-1.0,-1.0],[1.0,-1.0],[1.0,1.0],[0.0,1.0],[-1.0,1.0],[-1.0,-1.0]]]} 200000 3 null
{"type":"Polygon","coordinates":[[[-1.0,-1.0],[1.0,-1.0],[1.0,1.0],[0.0,1.0],[-1.0,1.0],[-1.0,-1.0]],[[5.0,0.0],[10.0,0.0],[10.0,5.0],[5.0,5.0],[5.0,0.0]]]} 200000 3 {"type":"Polygon","coordinates":[[[10.0, 5.0], [10.0, 0.0], [5.0, 0.0], [5.0, 5.0], [10.0, 5.0]]]}
{"type":"MultiPolygon","coordinates":[[[[-1.0,-1.0],[1.0,-1.0],[1.0,1.0],[0.0,1.0],[-1.0,1.0],[-1.0,-1.0]]],[[[5.0,0.0],[10.0,0.0],[10.0,5.0],[5.0,5.0],[5.0,0.0]]]]} 200000 3 {"coordinates":[[[10.0, 5.0], [10.0, 0.0], [5.0, 0.0], [5.0, 5.0], [10.0, 5.0]]], "type":"Polygon"}
{"type":"MultiPolygon","coordinates":[[[[-1.0,-1.0],[1.0,-1.0],[1.0,1.0],[0.0,1.0],[-1.0,1.0],[-1.0,-1.0]]],[[[5.0,0.0],[10.0,0.0],[10.0,5.0],[5.0,5.0],[5.0,0.0]]]]} 500000 3 null
{"type":"GeometryCollection","geometries":[{"type":"MultiLineString","coordinates":[[[0.0,0.0],[5.0,... 500000 3 {"type":"GeometryCollection","geometries":[{"type":"MultiLineString","coordinates":[[[0.0, 0.0], [10.0, 0.0]], [[0.0, -5.0],[10.0, 5.0]]]}]}
{"type":"GeometryCollection","geometries":[{"type":"Polygon","coordinates":[[[-1.0,-1.0],[1.0,-1.0],... 500000 3 null