Simplify geometry

Supported in: Batch, 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<Geometry>
  • Tolerance - Tolerance (meters).
    Expression<Long>
  • optional Coordinate precision - Maximum number of decimal places for coordinates (defaults to 6 decimal places).
    Expression<Long>

Output type: Geometry

Examples

Example 1: Base case

Argument values:

  • Geometry: Geometry
  • Tolerance: Tolerance
  • Coordinate precision: null
GeometryToleranceOutput
{"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
GeometryToleranceCoordinate precisionOutput
{"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]]]}120003{"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]]]}120006{"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]]]}1200010{"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
GeometryToleranceOutput
null0null

Example 4: Edge case

Argument values:

  • Geometry: Geometry
  • Tolerance: Tolerance
  • Coordinate precision: Coordinate precision
GeometryToleranceCoordinate precisionOutput
{"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]]]}2000003null
{"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]]]}2000003{"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]]]]}2000003{"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]]]]}5000003null
{"type":"GeometryCollection","geometries":[{"type":"MultiLineString","coordinates":[[[0.0,0.0],[5.0,...5000003{"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],...5000003null