SlideShare una empresa de Scribd logo
1 de 17
Descargar para leer sin conexión
GEO Colorado
 RTD Transit Data
    using CartoDB
Key Points
•   Introduce CartoDB
•   Explain about CartoCSS
•   SQL via CartoDB API's
•   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 Example
Goal: 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 Portal




http://www.rtd-denver.com
Existing Portal




http://www.rtd-denver.com
Existing Portal




http://www.rtd-denver.com
Data & Software

Shapefiles Used
•   http://www.rtd-denver.com/Developer.shtml


Software Used
•   HTML, JavaScript, CSS
•   jQuery
•   CartoDB, Leaflet, CloudMade Tiles
Interative Line Routes
DEMO
http://goo.gl/NWhpG

http://silverbiology.com/projects/cartodb/casestudies/denverrtd/
Resources
CartoCSS:
•   http://mapbox.com/tilemill/docs/manual/carto/
•   http://mapbox.com/carto/latest.html

CartoDB: http://www.cartodb.com

Leaflet: 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 route
SELECT * 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 b

Regexp_split_to_table ref: http://www.postgresql.org/docs/8.3/static/functions-matching.html


Example: “6, 12, 8, 112, 104” will be transformed to individual rows.
SQL Queries
#closest bus stops
SELECT * FROM busstops
ORDER BY the_geom <-> st_setsrid(st_makepoint(-106, 39),4326)
LIMIT 5


Indexed 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 route
SELECT 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 d
ON d.new_route = c.route


How 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 route
SELECT 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_webmercator
FROM busroutes WHERE route = '6‘
Better Methods & Missing API’s
• PgRoute http://pgrouting.org/
• API for route time tables
• Preferred Transfer locations

Más contenido relacionado

Destacado

Yahoo! Hack University: Accessibility Innovations and Challenges
Yahoo! Hack University: Accessibility Innovations and ChallengesYahoo! Hack University: Accessibility Innovations and Challenges
Yahoo! Hack University: Accessibility Innovations and ChallengesTed Drake
 
intro to information visualization
intro to information visualization intro to information visualization
intro to information visualization Joris Klerkx
 
What All Library Staff Should Know About Open Access to Research
What All Library Staff Should Know About Open Access to Research What All Library Staff Should Know About Open Access to Research
What All Library Staff Should Know About Open Access to Research Robyn Hall
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsLinkedIn
 

Destacado (7)

Creative Commons
Creative CommonsCreative Commons
Creative Commons
 
Census 2010
Census 2010Census 2010
Census 2010
 
The Power Of The Net
The Power Of The NetThe Power Of The Net
The Power Of The Net
 
Yahoo! Hack University: Accessibility Innovations and Challenges
Yahoo! Hack University: Accessibility Innovations and ChallengesYahoo! Hack University: Accessibility Innovations and Challenges
Yahoo! Hack University: Accessibility Innovations and Challenges
 
intro to information visualization
intro to information visualization intro to information visualization
intro to information visualization
 
What All Library Staff Should Know About Open Access to Research
What All Library Staff Should Know About Open Access to Research What All Library Staff Should Know About Open Access to Research
What All Library Staff Should Know About Open Access to Research
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving Cars
 

Similar a Geo CO - RTD Denver

What are customers building with new Bing Maps capabilities
What are customers building with new Bing Maps capabilitiesWhat are customers building with new Bing Maps capabilities
What are customers building with new Bing Maps capabilitiesMicrosoft Tech Community
 
SoTM US Routing
SoTM US RoutingSoTM US Routing
SoTM US RoutingMapQuest
 
OSCON july 2011
OSCON july 2011OSCON july 2011
OSCON july 2011chelm
 
Intro To PostGIS
Intro To PostGISIntro To PostGIS
Intro To PostGISmleslie
 
COMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdf
COMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdfCOMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdf
COMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdfAkshatTiwari530170
 
NodeUkraine - Postgresql для хипстеров или почему ваш следующий проект должен...
NodeUkraine - Postgresql для хипстеров или почему ваш следующий проект должен...NodeUkraine - Postgresql для хипстеров или почему ваш следующий проект должен...
NodeUkraine - Postgresql для хипстеров или почему ваш следующий проект должен...DmitryChirkin1
 
Mongoskin - Guilin
Mongoskin - GuilinMongoskin - Guilin
Mongoskin - GuilinJackson Tian
 
2014 bigdatacamp asya_kamsky
2014 bigdatacamp asya_kamsky2014 bigdatacamp asya_kamsky
2014 bigdatacamp asya_kamskyData Con LA
 
Pgrouting_foss4guk_ross_mcdonald
Pgrouting_foss4guk_ross_mcdonaldPgrouting_foss4guk_ross_mcdonald
Pgrouting_foss4guk_ross_mcdonaldRoss McDonald
 
Postgres Conference (PgCon) New York 2019
Postgres Conference (PgCon) New York 2019Postgres Conference (PgCon) New York 2019
Postgres Conference (PgCon) New York 2019Ibrar Ahmed
 
Web+GISという視点から見たGISの方向性
Web+GISという視点から見たGISの方向性Web+GISという視点から見たGISの方向性
Web+GISという視点から見たGISの方向性Hidenori Fujimura
 
PostgreSQL 9.4 JSON Types and Operators
PostgreSQL 9.4 JSON Types and OperatorsPostgreSQL 9.4 JSON Types and Operators
PostgreSQL 9.4 JSON Types and OperatorsNicholas Kiraly
 
Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016
Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016
Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016Luigi Dell'Aquila
 
Presto: Optimizing Performance of SQL-on-Anything Engine
Presto: Optimizing Performance of SQL-on-Anything EnginePresto: Optimizing Performance of SQL-on-Anything Engine
Presto: Optimizing Performance of SQL-on-Anything EngineDataWorks Summit
 
Postgres vs Mongo / Олег Бартунов (Postgres Professional)
Postgres vs Mongo / Олег Бартунов (Postgres Professional)Postgres vs Mongo / Олег Бартунов (Postgres Professional)
Postgres vs Mongo / Олег Бартунов (Postgres Professional)Ontico
 
Your Timestamps Deserve Better than a Generic Database
Your Timestamps Deserve Better than a Generic DatabaseYour Timestamps Deserve Better than a Generic Database
Your Timestamps Deserve Better than a Generic Databasejavier ramirez
 

Similar a Geo CO - RTD Denver (20)

What are customers building with new Bing Maps capabilities
What are customers building with new Bing Maps capabilitiesWhat are customers building with new Bing Maps capabilities
What are customers building with new Bing Maps capabilities
 
Spark - Citi Bike NYC
Spark - Citi Bike NYCSpark - Citi Bike NYC
Spark - Citi Bike NYC
 
SoTM US Routing
SoTM US RoutingSoTM US Routing
SoTM US Routing
 
OSCON july 2011
OSCON july 2011OSCON july 2011
OSCON july 2011
 
Pycon2011
Pycon2011Pycon2011
Pycon2011
 
Intro To PostGIS
Intro To PostGISIntro To PostGIS
Intro To PostGIS
 
COMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdf
COMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdfCOMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdf
COMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdf
 
NodeUkraine - Postgresql для хипстеров или почему ваш следующий проект должен...
NodeUkraine - Postgresql для хипстеров или почему ваш следующий проект должен...NodeUkraine - Postgresql для хипстеров или почему ваш следующий проект должен...
NodeUkraine - Postgresql для хипстеров или почему ваш следующий проект должен...
 
Mongoskin - Guilin
Mongoskin - GuilinMongoskin - Guilin
Mongoskin - Guilin
 
2014 bigdatacamp asya_kamsky
2014 bigdatacamp asya_kamsky2014 bigdatacamp asya_kamsky
2014 bigdatacamp asya_kamsky
 
Making Use of Query Layers & Spatial Views
Making Use of Query Layers & Spatial ViewsMaking Use of Query Layers & Spatial Views
Making Use of Query Layers & Spatial Views
 
Pgrouting_foss4guk_ross_mcdonald
Pgrouting_foss4guk_ross_mcdonaldPgrouting_foss4guk_ross_mcdonald
Pgrouting_foss4guk_ross_mcdonald
 
Postgres Conference (PgCon) New York 2019
Postgres Conference (PgCon) New York 2019Postgres Conference (PgCon) New York 2019
Postgres Conference (PgCon) New York 2019
 
Web+GISという視点から見たGISの方向性
Web+GISという視点から見たGISの方向性Web+GISという視点から見たGISの方向性
Web+GISという視点から見たGISの方向性
 
PostgreSQL 9.4 JSON Types and Operators
PostgreSQL 9.4 JSON Types and OperatorsPostgreSQL 9.4 JSON Types and Operators
PostgreSQL 9.4 JSON Types and Operators
 
Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016
Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016
Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016
 
Presto: Optimizing Performance of SQL-on-Anything Engine
Presto: Optimizing Performance of SQL-on-Anything EnginePresto: Optimizing Performance of SQL-on-Anything Engine
Presto: Optimizing Performance of SQL-on-Anything Engine
 
Postgres vs Mongo / Олег Бартунов (Postgres Professional)
Postgres vs Mongo / Олег Бартунов (Postgres Professional)Postgres vs Mongo / Олег Бартунов (Postgres Professional)
Postgres vs Mongo / Олег Бартунов (Postgres Professional)
 
Oh, that ubiquitous JSON !
Oh, that ubiquitous JSON !Oh, that ubiquitous JSON !
Oh, that ubiquitous JSON !
 
Your Timestamps Deserve Better than a Generic Database
Your Timestamps Deserve Better than a Generic DatabaseYour Timestamps Deserve Better than a Generic Database
Your Timestamps Deserve Better than a Generic Database
 

Más de Mike Giddens

SilverBiology DROCG
SilverBiology DROCGSilverBiology DROCG
SilverBiology DROCGMike Giddens
 
Small Herbaria Michigan - SilverCollection
Small Herbaria Michigan - SilverCollectionSmall Herbaria Michigan - SilverCollection
Small Herbaria Michigan - SilverCollectionMike Giddens
 
GeoCO GeoJSON & GeoLocate
GeoCO GeoJSON & GeoLocateGeoCO GeoJSON & GeoLocate
GeoCO GeoJSON & GeoLocateMike Giddens
 
GeoCO Denver Crime Presentation
GeoCO Denver Crime PresentationGeoCO Denver Crime Presentation
GeoCO Denver Crime PresentationMike Giddens
 
iDigBio Presentation - Botany 2012
iDigBio Presentation - Botany 2012iDigBio Presentation - Botany 2012
iDigBio Presentation - Botany 2012Mike Giddens
 

Más de Mike Giddens (6)

SilverBiology DROCG
SilverBiology DROCGSilverBiology DROCG
SilverBiology DROCG
 
Small Herbaria Michigan - SilverCollection
Small Herbaria Michigan - SilverCollectionSmall Herbaria Michigan - SilverCollection
Small Herbaria Michigan - SilverCollection
 
GeoCO GeoJSON & GeoLocate
GeoCO GeoJSON & GeoLocateGeoCO GeoJSON & GeoLocate
GeoCO GeoJSON & GeoLocate
 
HelpingScience
HelpingScienceHelpingScience
HelpingScience
 
GeoCO Denver Crime Presentation
GeoCO Denver Crime PresentationGeoCO Denver Crime Presentation
GeoCO Denver Crime Presentation
 
iDigBio Presentation - Botany 2012
iDigBio Presentation - Botany 2012iDigBio Presentation - Botany 2012
iDigBio Presentation - Botany 2012
 

Último

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 

Último (20)

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 

Geo CO - RTD Denver

  • 1. GEO Colorado RTD Transit Data using CartoDB
  • 2. Key Points • Introduce CartoDB • Explain about CartoCSS • SQL via CartoDB API's • Telling your story
  • 3. 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
  • 4. RTD Transit Data Example Goal: 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!!!
  • 8. Data & Software Shapefiles Used • http://www.rtd-denver.com/Developer.shtml Software Used • HTML, JavaScript, CSS • jQuery • CartoDB, Leaflet, CloudMade Tiles
  • 11. Resources CartoCSS: • http://mapbox.com/tilemill/docs/manual/carto/ • http://mapbox.com/carto/latest.html CartoDB: http://www.cartodb.com Leaflet: http://leaflet.cloudmade.com/
  • 12. CartoCSS #busroutes{ line-width:2; [new_route="16"]{ line-color:#BD362F } [new_route="1"]{ line-color:#51A351 } }
  • 13. SQL Queries # All stops for a single route SELECT * 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 b Regexp_split_to_table ref: http://www.postgresql.org/docs/8.3/static/functions-matching.html Example: “6, 12, 8, 112, 104” will be transformed to individual rows.
  • 14. SQL Queries #closest bus stops SELECT * FROM busstops ORDER BY the_geom <-> st_setsrid(st_makepoint(-106, 39),4326) LIMIT 5 Indexed 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/
  • 15. SQL Queries # returns a row if the bus stops are on the same route SELECT 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 d ON d.new_route = c.route How to write a query to graph routes for 1st or 2nd degree route. Bus transfers!!!
  • 16. Failed Queries??? #Only show the line between two points that fall on the bus route SELECT 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_webmercator FROM busroutes WHERE route = '6‘
  • 17. Better Methods & Missing API’s • PgRoute http://pgrouting.org/ • API for route time tables • Preferred Transfer locations