{ "settings" : { "map type": "globe", "start": { "lon": -122.461, "lat": 37.78, "height": 0.25, }, "extents": { "minlon": -123, "minlat": 37.0, "maxlon": -122, "maxlat": 38.0, "minheight": 0.000227609242, "maxheight": 0.00334425364, "mintilt": 1.21771169, "maxtilt": 0.0 }, "info url": "http://mousebird.github.io/WhirlyVizConfig/config_1_2/sftransit.html" }, "background": [ { "type": "color", "color": "#82CAFAFF", "_comment": "light sky blue" }, { "type": "tilejson", "url": "http://a.tiles.mapbox.com/v3/mousebird.map-qnku0pxd.json", "maxzoom": 17 }, { "type": "geojson", "styles": ["thick_line_style"], "url": "http://mousebird.cartodb.com/api/v2/sql?format=GeoJSON&q=SELECT the_geom FROM sf_bus_routes" } ], "styles": [ { "name": "stop_style", "type": "cylinder", "baseheight": 0.0000005, "radius": 0.000003, "colors": ["#6FCBF5FF","#F56F6FFF"] }, { "name": "thick_line_style", "type": "vector", "filled": false, "width": 2.0, "color": "#66666644" } ], "controls": [ { "name": "start_date", "display name": "Start Date", "type": "datetime", "default": "2012-10-01 08:00:00", "min query": "min_date_query", "max query": "max_date_query" }, { "name": "end_date", "display name": "End Date", "type": "datetime", "default": "2012-10-01 10:00:00", "min query": "min_date_query", "max query": "max_date_query" }, { "name": "route", "display name": "Routes", "type": "list", "multiselect": true, "default" : "14", "initial index": 8, "value query": "route_list_query" } ], "queries": [ { "name": "boarding_query", "display name": "Passengers Boarding", "type": "geojson", "style": "stop_style", "query": "http://mousebird.cartodb.com/api/v2/sql?format=GeoJSON&q=WITH alias_1 AS (SELECT sf_bus_stops.the_geom, sf_bus_stops.stopname, SUM(sf_passenger_count_view_table.pass_on) as sum_pass_on, SUM(sf_passenger_count_view_table.pass_off) as sum_pass_off, SUM(pass_on+pass_off) as sum_total from sf_bus_stops inner join sf_passenger_count_view_table on sf_bus_stops.stopid = sf_passenger_count_view_table.stop_id where sf_passenger_count_view_table.timepullout > TIMESTAMP '{{start_date}}' and sf_passenger_count_view_table.timepullout < TIMESTAMP '{{end_date}}' and sf_passenger_count_view_table.route in ({{route}}) group by sf_bus_stops.the_geom, sf_bus_stops.stopid, sf_bus_stops.stopname) SELECT the_geom, stopname, sum_pass_on/(select sum_total from alias_1 order by sum_total desc limit 1)*0.0001 as height0, sum_pass_off/(select sum_total from alias_1 order by sum_total desc limit 1)*0.0001 as height1, sum_pass_on, sum_pass_off from alias_1 where (sum_pass_on > 0 or sum_pass_off > 0) group by alias_1.the_geom, alias_1.sum_pass_on, alias_1.sum_pass_off, alias_1.stopname" }, { "name": "route_list_query", "type": "cartodb list", "query": "http://mousebird.cartodb.com/api/v2/sql?q=SELECT distinct route as list_value, route as display_name FROM sf_passenger_count_view_table order by route" }, { "name": "stop_query", "type": "cartodb real", "query": "SELECT SUM(pass_on) as 'Passengers Boarding', FROM sf_bus_stops where timepullout > {{start_date}} and timepullout < {{end_date}} and stop_id = {{stopid}}" }, { "name": "min_date_query", "type": "cartodb timestamp", "query": "http://mousebird.cartodb.com/api/v2/sql?q=SELECT MIN(timepullout) as value FROM sf_passenger_count_view_table" }, { "name": "max_date_query", "type": "cartodb timestamp", "query": "http://mousebird.cartodb.com/api/v2/sql?q=SELECT MAX(timepullout) as value FROM sf_passenger_count_view_table" } ], "events": [ { "type": "onSelect", "actions": [ { "type" : "clear popups"}, { "type" : "add popup", "minVis": 0, "maxVis": 0.0004, "text" : "{{stopname}}
Passengers On: {{sum_pass_on}}
Passengers Off: {{sum_pass_off}}"} ] }, { "type": "onTap", "actions": [ { "type" : "clear popups"} ] }, { "type": "onConfig", "actions": [ { "type" : "query clear" }, { "type" : "clear popups"}, { "type" : "geo query", "query" : "boarding_query" }, { "type" : "set legend", "text" : "Start: {{start_date}}
End: {{end_date}}
Routes: {{route}}" } ] }, { "type": "onStartup", "actions": [ { "type": "set display", "text": "SF Bus Stops" }, { "type": "geo query", "query": "boarding_query" }, { "type" : "set legend", "text" : "Start: {{start_date}}
End: {{end_date}}
Routes: {{route}}" } ] } ] }