Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Functions returning geometries
Collections
14. ST_Length
Summary

Instruction

Great job! Just like ST_Area returns the total area of all polygons inside a collection, ST_Length returns the total length of all linestrings in the collection. Take a look:

SELECT 
  id, 
  ST_Length(ST_Transform(geo_data, 26910)) 
FROM sf_chains;

The query above will show the id of each collection alongside the total length of all linestrings it contains.

Exercise

What is the total length of all bicycle routes in the Downtown district (collection with id = 90)? Provide the answer in meters.

Stuck? Here's a hint!

Remember to use ST_Tranform with an SRID of 26910 before you calculate ST_Length.

The row with the id = 90 from the sf_chains table contains all the bicycle routes that are within or intersect with the Downtown district.