ST_Length
Definition
ST_Length returns the length of a line string or multiline string.
Syntax
sde.st_length (ln1 sde.st_geometry) sde.st_length (mln1 sde.st_geometry)
Return type
Double precision
Example
A local ecologist studying the migratory patterns of the salmon population in the county's waterways wants the length of all stream and river systems within the county.
The waterways table is created with the ID and name columns, which identify each stream and river system stored in the table. The water column is a multilinestring because the river and stream systems are often aggregates of several linestrings.
CREATE TABLE waterways (oid integer, name varchar(128), water sde.st_geometry);
INSERT INTO waterways (oid, name, water)
VALUES (
1111,
'Genesee',
sde.st_multilinestring ('multilinestring ((33 2, 34 3, 35 6),
(28 4, 29 5, 31 8, 43 12), (39 3, 37 4, 36 7))', 0)
);
The query returns the name of each system along with the length of the system generated by the ST_Length function.
Oracle
SELECT name, sde.st_length (water) "Length"
FROM WATERWAYS;
NAME Length
Genesee 27.6437123
PostgreSQL
SELECT name AS "Waterway Name", sde.st_length (water)
AS "Length"
FROM waterways;
Waterway Name | Length
Genesee | 27.6437123387202
6/19/2015