Skip to content

ST_Force3D

Forces a geometry or geography into a XYZ coordinate model with an optional Z value.

Usage

geometry ST_Force3D(geom: geometry)
geometry ST_Force3D(geom: geometry, z: double)
geography ST_Force3D(geog: geography)
geography ST_Force3D(geog: geography, z: double)

Arguments

  • geog (geography): Input geography
  • z (double)
  • geom (geometry): Input geometry

Description

If the geometry already has Z values they are preserved; otherwise the optional z argument (default 0) is used.

Examples

SELECT ST_Force3D(ST_GeomFromWKT('POINT (1 2)'), 10.0);
┌─────────────────────────────────────────────────────────────┐
│ st_force3d(st_geomfromwkt(Utf8("POINT (1 2)")),Float64(10)) │
│                           geometry                          │
╞═════════════════════════════════════════════════════════════╡
│ POINT Z(1 2 10)                                             │
└─────────────────────────────────────────────────────────────┘
SELECT ST_Force3D(ST_GeomFromWKT('POINT (1 2)'));
┌─────────────────────────────────────────────────┐
│ st_force3d(st_geomfromwkt(Utf8("POINT (1 2)"))) │
│                     geometry                    │
╞═════════════════════════════════════════════════╡
│ POINT Z(1 2 0)                                  │
└─────────────────────────────────────────────────┘
SELECT ST_Force3D(ST_GeogFromWKT('POINT (1 2)'), 10.0);
┌─────────────────────────────────────────────────────────────┐
│ st_force3d(st_geogfromwkt(Utf8("POINT (1 2)")),Float64(10)) │
│                          geography                          │
╞═════════════════════════════════════════════════════════════╡
│ POINT Z(1 2 10)                                             │
└─────────────────────────────────────────────────────────────┘