5. Geospatial Functions : ST_Length
 
Share this page                  
ST_Length
ST_LENGTH(g Geometry)
Returns the length of g. Use for linestrings. For polygons, use PERIMETER().
Result type: float
Note:  You cannot call this function with simply LENGTH because it is used elsewhere in SQL; you must use ST_LENGTH.
SELECT ST_LENGTH(LINEFROMTEXT('LINESTRING(1 1,1 2,3 2)'));
-------------
col1
-------------
3.000
-------------