Skip to content

Instantly share code, notes, and snippets.

@andrewxhill
Created August 19, 2015 12:57
Show Gist options
  • Save andrewxhill/76f6c5782b5be7552232 to your computer and use it in GitHub Desktop.
Save andrewxhill/76f6c5782b5be7552232 to your computer and use it in GitHub Desktop.
USPO map lives again!
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>CartoDB + Time</title>
<link rel="shortcut icon" href="http://cartodb.com/favicon/favicon_32x32.ico" />
<style>
html, body, #map {
height: 100%;
padding: 0;
margin: 0;
}
</style>
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/themes/css/cartodb.css" />
<script src="http://libs.cartocdn.com/cartodb.js/v3/cartodb.js"></script>
<script type="text/javascript">
function main() {
var map = new L.Map('map', {
zoomControl: false,
center: [40, -110],
zoom: 4
});
L.tileLayer('http://tile.stamen.com/toner/{z}/{x}/{y}.png', {
attribution: 'Stamen'
}).addTo(map);
cartodb.createLayer(map, {
type: "torque",
order: 1,
options: {
query: "",
table_name: "us_po_offices",
user_name: "viz2",
tile_style: '/** torque visualization */ Map { -torque-frame-count:128; -torque-animation-duration:16; -torque-time-attribute:"built"; -torque-aggregation-function:"count(cartodb_id)"; -torque-resolution:4; -torque-data-aggregation:cumulative; } #us_po_offices{ comp-op: plus; marker-opacity: 0.9; marker-line-color: #FFF; marker-line-width: 0; marker-line-opacity: 1; marker-type: rectangle; marker-width: 2; marker-fill: #2929FF; }'
}
}).done(function(layer) {
map.addLayer(layer);
});
}
// you could use $(window).load(main);
window.onload = main;
</script>
</head>
<body>
<div id="map"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment