Created
March 4, 2013 16:32
-
-
Save javisantana/5083523 to your computer and use it in GitHub Desktop.
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 name="viewport" content="initial-scale=1.0, user-scalable=no" /> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/> | |
<style> | |
html, body, #map { | |
height: 100%; | |
padding: 0; | |
margin: 0; | |
} | |
</style> | |
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v2/themes/css/cartodb.css" /> | |
<!--[if lte IE 8]> | |
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v2/themes/css/cartodb.ie.css" /> | |
<![endif]--> | |
</head> | |
<body> | |
<div id="map"></div> | |
</body> | |
<!-- include cartodb.js library --> | |
<script src="http://libs.cartocdn.com/cartodb.js/v2/cartodb.uncompressed.js"></script> | |
<script> | |
function main() { | |
window.map = L.map('map', { | |
zoomControl: false, | |
center: [19.4144686374295, -99.02389526367188], | |
zoom: 10 | |
}) | |
L.tileLayer('http://tile.stamen.com/toner/{z}/{x}/{y}.png', { | |
attribution: 'MapBox' | |
}).addTo(map); | |
var layerOptions = { | |
query: "SELECT *, 'puntos' as group FROM suredf2 WHERE com = '0'", | |
tile_style: "#{{table_name}}[mapnik-geometry-type=linestring] {line-color: #FF6600; line-width: 2; line-opacity: 0.7;}#{{table_name}}[mapnik-geometry-type=polygon] { polygon-fill:#6CC056;polygon-opacity: 0.05;line-opacity:1;line-color: #109DCD;}#{{table_name}}[votos > 10]{polygon-opacity: 1;}" | |
} | |
var v = 'http://conbdevaca.cartodb.com/api/v1/viz/2336/viz.json' | |
cartodb.createLayer(map, v, layerOptions) | |
.on('done', function(layer) { | |
map.addLayer(layer); | |
layer.on('featureOver', function(e, pos, latlng, data) { | |
cartodb.log.log(e, pos, latlng, data); | |
}); | |
layer.on('error', function(err) { | |
cartodb.log.log('error: ' + err); | |
}); | |
}).on('error', function() { | |
cartodb.log.log("some error occurred"); | |
}); | |
} | |
// you could use $(window).load(main); | |
window.onload = main; | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment