Skip to content

Instantly share code, notes, and snippets.

@ramiroaznar
Created December 16, 2016 09:11
Show Gist options
  • Save ramiroaznar/a8cfc3fd1a443aaaff1aa061283a14b4 to your computer and use it in GitHub Desktop.
Save ramiroaznar/a8cfc3fd1a443aaaff1aa061283a14b4 to your computer and use it in GitHub Desktop.
Routing Analysis with CARTO geocoding functions
WITH a AS (
SELECT * FROM mad_comm_home_centroids
),
b AS (
SELECT * FROM mad_comm_work_centroids
)
SELECT
c.duration as seconds,
c.duration/60 as minutes,
c.length,
c.shape as the_geom
FROM
a, b, cdb_route_point_to_point(a.the_geom, b.the_geom, 'car') c
WHERE
a.cartodb_id = b.cartodb_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment