46 lines
1.5 KiB
HTML
46 lines
1.5 KiB
HTML
<html>
|
|
<head>
|
|
<link rel="stylesheet" href="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.12/themes/css/cartodb.css" />
|
|
<script src="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.12/cartodb.js"></script>
|
|
<style>
|
|
html, body {width:100%; height:100%; padding: 0; margin: 0;}
|
|
#cartodb-map { width: 100%; height:100%; background: black;}
|
|
</style>
|
|
|
|
<script>
|
|
var map;
|
|
function init(){
|
|
// initiate leaflet map
|
|
map = new L.Map('cartodb-map', {
|
|
center: [40,-98],
|
|
zoom: 4
|
|
})
|
|
|
|
L.tileLayer('https://dnv9my2eseobd.cloudfront.net/v3/cartodb.map-4xtxp73f/{z}/{x}/{y}.png', {
|
|
attribution: 'Mapbox <a href="http://mapbox.com/about/maps" target="_blank">Terms & Feedback</a>'
|
|
}).addTo(map);
|
|
|
|
var layerUrl = 'https://documentation.cartodb.com/api/v2/viz/236085de-ea08-11e2-958c-5404a6a683d5/viz.json';
|
|
|
|
cartodb.createLayer(map, layerUrl)
|
|
.addTo(map)
|
|
.on('done', function(layer) {
|
|
// change the query for the first layer
|
|
var subLayerOptions = {
|
|
sql: "SELECT * FROM example_cartodbjs_1 where adm0_a3 = 'USA'",
|
|
cartocss: "#example_cartodbjs_1{marker-fill: #109DCD; marker-width: 5; marker-line-color: white; marker-line-width: 0;}"
|
|
}
|
|
|
|
layer.getSubLayer(0).set(subLayerOptions);
|
|
}).on('error', function() {
|
|
//log the error
|
|
});
|
|
}
|
|
</script>
|
|
</head>
|
|
|
|
<body onload="init()">
|
|
<div id='cartodb-map'></div>
|
|
</body>
|
|
</html>
|