Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ramiroaznar
Created July 26, 2016 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramiroaznar/8cb2e16bfaaed3d1374ee9c75f9db4e4 to your computer and use it in GitHub Desktop.
Save ramiroaznar/8cb2e16bfaaed3d1374ee9c75f9db4e4 to your computer and use it in GitHub Desktop.
SQL & CartoCSS for routing
WITH
origin as (
SELECT the_geom FROM table_name WHERE cartodb_id = 1
),
destiny as (
SELECT the_geom FROM table_name WHERE cartodb_id = 2
)
SELECT ST_Transform(shape, 3857) as the_geom_webmercator
FROM origin, destiny, cdb_route_point_to_point(origin.the_geom, destiny.the_geom, 'car')
#table_name{
line-opacity: 1;
line-color: #000;
line-width: 5;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment