Skip to content

ST_Snap

Snaps input geometry to reference geometry within tolerance.

Usage

geometry ST_Snap(geomA: geometry, geomB: geometry, tolerance: double)

Arguments

  • geomA (geometry): Input geometry
  • geomB (geometry): Input geometry
  • tolerance (double)

Description

Snaps input geometry to reference geometry within tolerance. Result geometry aligns to the reference geometry where within tolerance distance.

Examples

SELECT ST_Snap(
    ST_GeomFromWKT('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))'),
    ST_GeomFromWKT('LINESTRING(0 0.1, 1 0.1)'),
    0.2
);
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_snap(st_geomfromwkt(Utf8("POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))")),st_geomfr │
│            omwkt(Utf8("LINESTRING(0 0.1, 1 0.1)")),Float64(0.2))…            │
╞══════════════════════════════════════════════════════════════════════════════╡
│ POLYGON((0 0.1,1 0.1,1 1,0 1,0 0.1))                                         │
└──────────────────────────────────────────────────────────────────────────────┘