Stanley Cup Champions Since 1915

Stanley Cup Champions Since 1915:

Average Location of Stanley Cup Champions Since 1915:

The average locations were created using a window function in PostgreSQL. We can utilise the geography type to take into account the curvature of the earth and make the calculation on a spheroid.

So for the average location of the last five years:

select id,
ST_Centroid(st_collect(geom)
over (ORDER BY id ROWS BETWEEN 4 PRECEDING AND CURRENT ROW)::geography,
True)::geometry as five_year_cent
from nhl.winner_1915

Leave a Reply

Your email address will not be published. Required fields are marked *