Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Dynamic + vector maps using OSM with CartoDB

Dynamic + vector maps using OSM with CartoDB

Fun with Vecnik, CartoDB, and other stuff

www.stateofthemap.us
www.cartodb.com

Andrew W Hill

June 08, 2013
Tweet

More Decks by Andrew W Hill

Other Decks in Technology

Transcript

  1. Pick a simple algorithm For each OpenPaths point Find the

    3 closest streets by distance Assign 0.5, 0.3, 0.2 in that order
  2. WITH points AS ( SELECT (SELECT cartodb_id FROM axh_roads ORDER

    BY a.the_geom <-> the_geom LIMIT 1) as first, (SELECT cartodb_id FROM axh_roads ORDER BY a.the_geom <-> the_geom OFFSET 1 LIMIT 1) as second, (SELECT cartodb_id FROM axh_roads ORDER BY a.the_geom <-> the_geom OFFSET 2 LIMIT 1) as third FROM axh_openpaths a) UPDATE axh_roads b SET openpaths_score = openpaths_score + 0.5 * (SELECT count(*) FROM points WHERE first = b.cartodb_id) + 0.3 * (SELECT count(*) FROM points WHERE second = b.cartodb_id) + 0.2 * (SELECT count(*) FROM points WHERE third = b.cartodb_id) The Algorithm in SQL