-
-
Save ZacSweers/99d61295437042746dd9 to your computer and use it in GitHub Desktop.
Caltrain Ridership
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>Caltrain Ridership | blech.github.io</title> | |
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' /> | |
<script src="//code.jquery.com/jquery-1.10.2.min.js"></script> | |
<script src='//api.tiles.mapbox.com/mapbox.js/v1.6.1/mapbox.js'></script> | |
<script src='//api.tiles.mapbox.com/mapbox.js/plugins/leaflet-hash/v0.2.1/leaflet-hash.js'></script> | |
<link href='//api.tiles.mapbox.com/mapbox.js/v1.6.1/mapbox.css' rel='stylesheet' /> | |
<link href="/geojson/{{ date }}" rel="geojson" type="application/json"> | |
<style> | |
body { margin:0; padding:0; } | |
#map { position:absolute; top:0; bottom:0; width:100%; } | |
</style> | |
</head> | |
<body> | |
<div id='map'></div> | |
<script> | |
var map = L.mapbox.map('map', 'paulmison.gofl3m15') | |
.setView([37.5326, -122.1305], 11); | |
var hash = new L.Hash(map); | |
var draw_geojson = function(data) { | |
var markerLayer = L.mapbox.markerLayer() | |
markerLayer.setGeoJSON(data).addTo(map); | |
map.fitBounds(markerLayer.getBounds()); | |
}; | |
var draw_data = function(data) { | |
var featureGroup = L.featureGroup().addTo(map); | |
var options = { | |
color: '#000', // Stroke color | |
opacity: 1, // Stroke opacity | |
weight: 1, // Stroke weight | |
fillColor: '#933', // Fill color | |
fillOpacity: 0.6 // Fill opacity | |
}; | |
for (var i = 0; i < data['features'].length; i++) { | |
feature = data['features'][i] | |
console.log(feature['geometry']['coordinates']) | |
console.log(feature['properties']) | |
var coords = [feature['geometry']['coordinates'][1], feature['geometry']['coordinates'][0]] | |
var radius = Math.sqrt(200*feature['properties']['2013']) | |
var circle = L.circle(coords, radius, options).addTo(featureGroup); | |
} | |
} | |
$.getJSON('/blech/raw/8838444/caltrain.geojson', draw_geojson); | |
$.getJSON('/blech/raw/8838444/dotspotting-sheet-2969.json', draw_data); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment