ST_MinZ

Definition

ST_MinZ takes a geometry as an input parameter and returns its minimum z-coordinate.

Syntax

Oracle and PostgreSQL

sde.st_minz (geometry1 sde.st_geometry)

SQLite

st_minz (geometry1 geometryblob)

Return type

Oracle and PostgreSQL

Number

If no z values are present, NULL is returned.

SQLite

Double precision

If no z values are present, NULL is returned.

Example

The table, minz_test, is created and two polygons inserted to it. ST_MinZ is then run to determine the minimum z-coordinate value in each polygon.

Oracle

CREATE TABLE minz_test (
 id integer,
 geometry sde.st_geometry
);

INSERT INTO MINZ_TEST VALUES (
 1901,
 sde.st_polygon ('polygon zm((110 120 20 3, 110 140 22 3, 120 130 26 4, 110 120 20 3))', 4326)
);

INSERT INTO MINZ_TEST VALUES (
 1902,
 sde.st_polygon ('polygon zm((0 0 40 7, 0 4 35 9, 5 4 32 12, 5 0 31 5, 0 0 40 7))', 4326)
);

SELECT id, sde.st_minz (geometry) MinZ
 FROM MINZ_TEST;

        ID       MINZ

      1901         20
      1902         31

PostgreSQL

CREATE TABLE minz_test (
 id integer,
 geometry st_geometry
);

INSERT INTO minz_test VALUES (
 1901,
 st_polygon ('polygon zm((110 120 20 3, 110 140 22 3, 120 130 26 4, 110 120 20 3))', 4326)
);

INSERT INTO minz_test VALUES (
 1902,
 st_polygon ('polygon zm((0 0 40 7, 0 4 35 9, 5 4 32 12, 5 0 31 5, 0 0 40 7))', 4326)
);

SELECT id, st_minz (geometry) 
 AS MinZ
 FROM minz_test;

        id       minz

      1901         20
      1902         31

SQLite

CREATE TABLE minz_test (
 id integer
);

SELECT AddGeometryColumn (
 NULL,
 'minz_test',
 'geometry',
 4326,
 'polygonzm',
 'xyzm',
 'null'
);

INSERT INTO minz_test VALUES (
 1901,
 st_polygon ('polygon zm((110 120 20 3, 110 140 22 3, 120 130 26 4, 110 120 20 3))', 4326)
);

INSERT INTO minz_test VALUES (
 1902,
 st_polygon ('polygon zm((0 0 40 7, 0 4 35 9, 5 4 32 12, 5 0 31 5, 0 0 40 7))', 4326)
);

SELECT id, st_minz (geometry) 
 AS "MinZ"
 FROM minz_test;

id        MinZ

1901      20.0
1902      31.0

Related Topics

6/19/2015