xxxxxxxxxx
<html>
<head>
<title>Seven Years war demo | CartoDB.js</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="https://cartodb.com/assets/favicon.ico" />
<style>
html, body, #map {
height: 100%;
padding: 0;
margin: 0;
}
</style>
<link rel="stylesheet" href="https://libs.cartocdn.com/cartodb.js/v3/3.15/themes/css/cartodb.css" />
</head>
<body>
<div id="map"></div>
<!-- include cartodb.js library -->
<script src="https://libs.cartocdn.com/cartodb.js/v3/3.15/cartodb.js"></script>
<script>
function main() {
cartodb.createVis('map', 'https://fooolosopher.cartodb.com/api/v2/viz/563de894-b57f-11e5-b36b-0e3ff518bd15/viz.json', {
shareable: true,
title: false,
description: false,
search: false,
tiles_loader: false,
center_lat: 50.937204,
center_lon: 14.82501,
zoom: 4,
widget_text:false
})
.done(function(vis, layers) {
// layer 0 is the base layer, layer 1 is cartodb layer
// setInteraction is disabled by default
layers[1].setInteraction(true);
layers[1].on('featureOver', function(e, latlng, pos, data) {
cartodb.log.log(e, latlng, pos, data);
});
// you can get the native map to work with it
var map = vis.getNativeMap();
cartodb.createLayer(map, {
user_name: 'fooolosopher',
type: 'cartodb',
sublayers: [{
sql: "SELECT * FROM countries WHERE relation='1'OR name_long='Belarus' or postal='CZ'",
cartocss: '#countries {polygon-fill: #31a354; polygon-opacity: 0.1;}'
},
{
sql: "SELECT * FROM countries WHERE relation='-1' or postal='GE' or postal='IRL'",
cartocss: '#countries {polygon-fill: #f03b20; polygon-opacity: 0.1;}'
}]
})
.addTo(map)
.done(function(layer) {
//DO STUFF
});
// now, perform any operations you need
// map.setZoom(3);
// map.panTo([50.5, 30.5]);
})
.error(function(err) {
console.log(err);
});
}
window.onload = main;
</script>
</body>
</html>
Modified http://libs.cartocdn.com/cartodb.js/v3/3.15/cartodb.js to a secure url
https://libs.cartocdn.com/cartodb.js/v3/3.15/cartodb.js