Introduction
Points
Linestrings
Polygons
Summary

Instruction

Great, we have our SRID: 26910. What can we do with it? Well, this is where ST_Transform function comes in handy. Do you remember our query from the ST_Length exercise? Here it is again as a refresher:

SELECT 
  ST_Length(course) 
FROM sf_selected_railways 
WHERE id = 1

The answer was 0.00202885260347101777. Of course, the result in degrees does not tell as anything meaningful. However, if we use the ST_Tranform function, we get the result in meters:

SELECT 
  ST_Length(ST_Transform(course,26910)) 
FROM sf_selected_railways 
WHERE id = 1

Note that we provided the SRID as the second argument to the ST_Transform function. Simply speaking, the ST_Transform function allows us to change the units in which the output is displayed.

Exercise

Find the sum of lengths of all railways from the sf_selected_railways table. Display the result in meters.

Stuck? Here's a hint!

You will have to pass in ST_Length function to the aggregate function: SUM().

Console

Code editor

Result

TableConsole