May 2017
Beginner to intermediate
328 pages
7h 17m
English
For lines, the length is calculated by the ST_Length function. It takes one argument, the input geometry, which can be a LineString or MultiLineString. When the argument is of the geometry type, the planimetric calculation will take place and the output length will be given in units of the input geometry's coordinate system.
Here is an example of a three-point LineString:
SELECT ST_Length( ST_MakeLine(ARRAY[ST_MakePoint(391390,5817855),ST_MakePoint(391490,5817955), ST_MakePoint(391590,5818055)])); st_length ------------------ 282.842712474619
For latitude-longitude coordinates, either the geography type, a type cast, or a ST_Length_Spheroid function should be used. Here is an example of a type cast being used:
SELECT ST_Length( ...Read now
Unlock full access