Last active
August 29, 2015 13:55
-
-
Save strk/8704942 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH trip AS ( | |
SELECT ST_MakeLine(the_geom_webmercator ORDER BY cartodb_id ASC) as g | |
FROM jackerouak | |
), | |
params AS ( | |
SELECT | |
greatest(st_xmax(g)-st_xmin(g), st_ymax(g)-st_ymin(g))/20 as maxlen_old, | |
CDB_XYZ_Resolution(4)*10 as maxlen | |
FROM trip | |
), | |
dump AS ( | |
SELECT (ST_DumpPoints(ST_Segmentize(t.g, p.maxlen))).* | |
FROM trip t, params p | |
) | |
SELECT path as cartodb_id, geom as the_geom_webmercator | |
FROM dump |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment