ST_TessellateGeom¶
Converts a geography to geometry, densifying edges to approximate geodesic segments as planar lines.
Usage¶
geometry ST_TessellateGeom(geog: geography, tolerance: double)
Arguments¶
- geog (geography): Input geography
- tolerance (double)
Description¶
Converts a geography to a geometry while tessellating edges using spherical (geodesic) interpolation. The tolerance parameter specifies the maximum deviation in meters between the original spherical edge and the tessellated planar approximation. This is useful when converting geographies to geometries while preserving the shape of geodesic edges as approximated line segments.
When an edge crosses the antimeridian, the returned coordinates are “wrapped” such that the returned longitude is either greater than 180 or less than -180. This helps produce valid geometry in more cases (e.g., linestring or polygon crossing the antimeridian); however, it does not produce valid geometry in the case of a polygon ring that spans the full longitude range (e.g., Antarctica).
Examples¶
SELECT ST_TessellateGeom(
ST_GeogFromText('LINESTRING (-10 50, 10 50)'),
1000
);
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_tessellategeom(st_geogfromtext(Utf8("LINESTRING (-10 50, 10 50)")),Int64( │
│ 1000))… │
╞══════════════════════════════════════════════════════════════════════════════╡
│ LINESTRING(-10 50,-7.519743251244511 50.18810937274429,-5.0226581707381825 … │
└──────────────────────────────────────────────────────────────────────────────┘
When a linestring crosses the antimeridian, coordinates are wrapped to keep the geometry continuous:
SELECT ST_TessellateGeom(
ST_GeogFromText('LINESTRING (170 70, -175 70, -175 60, 170 60)'),
1000
);
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_tessellategeom(st_geogfromtext(Utf8("LINESTRING (170 70, -175 70, -175 60 │
│ , 170 60)")),Int64(1000))… │
╞══════════════════════════════════════════════════════════════════════════════╡
│ LINESTRING(170 70,171.8625596259595 70.0688383045584,173.73574007128954 70.… │
└──────────────────────────────────────────────────────────────────────────────┘