Geo CO - RTD Denver
Upcoming SlideShare
Loading in...5
×
 

Geo CO - RTD Denver

on

  • 527 views

Presentation on CartoDB at the Colorado Meetup using the RTD Denver transportation routes.

Presentation on CartoDB at the Colorado Meetup using the RTD Denver transportation routes.

Statistics

Views

Total Views
527
Views on SlideShare
527
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Geo CO - RTD Denver Geo CO - RTD Denver Presentation Transcript

    • GEO Colorado RTD Transit Data using CartoDB
    • Key Points• Introduce CartoDB• Explain about CartoCSS• SQL via CartoDB APIs• Telling your story
    • CartoDB• Geospatial mapping• Data stored in the cloud• PostGIS engine• Supports CartoCSS• SQL API• Leaflet and Google Maps Libraries• Graphical Editor for Point & Polygons• Lots of Examples• Free 5MB account• FAST!!!www.cartodb.com
    • RTD Transit Data ExampleGoal: To create an interactive map to get the nearest location from where I am at and to find any intersecting routes based on my destination.Requirements:• Use open data• Use open source software• Real Time Interaction• Enjoyable to users• Make it informative and Fast!!!
    • Existing Portalhttp://www.rtd-denver.com
    • Existing Portalhttp://www.rtd-denver.com
    • Existing Portalhttp://www.rtd-denver.com
    • Data & SoftwareShapefiles Used• http://www.rtd-denver.com/Developer.shtmlSoftware Used• HTML, JavaScript, CSS• jQuery• CartoDB, Leaflet, CloudMade Tiles
    • Interative Line Routes
    • DEMOhttp://goo.gl/NWhpGhttp://silverbiology.com/projects/cartodb/casestudies/denverrtd/
    • ResourcesCartoCSS:• http://mapbox.com/tilemill/docs/manual/carto/• http://mapbox.com/carto/latest.htmlCartoDB: http://www.cartodb.comLeaflet: http://leaflet.cloudmade.com/
    • CartoCSS#busroutes{ line-width:2; [new_route="16"]{ line-color:#BD362F } [new_route="1"]{ line-color:#51A351 }}
    • SQL Queries# All stops for a single routeSELECT * FROM (SELECT * FROM (SELECT replace(regexp_split_to_table(routes, E,), , ) as new_route, bsid, the_geom FROM busstops) as a WHERE a.new_route=6) as bRegexp_split_to_table ref: http://www.postgresql.org/docs/8.3/static/functions-matching.htmlExample: “6, 12, 8, 112, 104” will be transformed to individual rows.
    • SQL Queries#closest bus stopsSELECT * FROM busstopsORDER BY the_geom <-> st_setsrid(st_makepoint(-106, 39),4326)LIMIT 5Indexed Nearest Neighbor Search• Using the <-> operator, you get the nearest neighbor using the centers of the bounding boxes to calculate the inter-object distances.• Using the <#> operator, you get the nearest neighbor using the bounding boxes themselves to calculate the inter-object distances.Ref: http://blog.opengeo.org/tag/knn/WGS 84 (4326) http://spatialreference.org/ref/epsg/4326/
    • SQL Queries# returns a row if the bus stops are on the same routeSELECT c.* FROM busroutes c JOIN (SELECT a.new_route, a.bsid, b.bsid FROM (SELECT replace(regexp_split_to_table(routes, E,), , ) as new_route, bsid, the_geom FROM busstops WHERE bsid = {{{START STOP ID}}}) as a JOIN (SELECT replace(regexp_split_to_table(routes, E,), , ) as new_route, bsid, the_geom FROM busstops WHERE bsid = {{{END STOP ID}}}) as b ON a.bsid = b.bsid) as dON d.new_route = c.routeHow to write a query to graph routes for 1st or 2nd degree route. Bus transfers!!!
    • Failed Queries???#Only show the line between two points that fall on the bus routeSELECT st_transform( ST_Line_Substring(the_geom,(SELECT ST_Line_Locate_Point((SELECT ST_GeometryN(the_geom,5) FROM busroutes WHERE route=6),(SELECT the_geom FROM (SELECT replace(regexp_split_to_table(routes, E,), , ) as new_route, bsid, the_geom FROM busstops WHERE bsid = 12978) as a WHERE a.new_route=6))),(SELECT ST_Line_Locate_Point((SELECT ST_GeometryN(the_geom,5) FROM busroutes WHERE route=6),(SELECT the_geom FROM (SELECT replace(regexp_split_to_table(routes, E,), , ) as new_route, bsid, the_geom FROM busstops WHERE bsid = 10227) as a WHERE a.new_route=6)))), 3857) as the_geom_webmercatorFROM busroutes WHERE route = 6‘
    • Better Methods & Missing API’s• PgRoute http://pgrouting.org/• API for route time tables• Preferred Transfer locations