Skip to content

Instantly share code, notes, and snippets.

@iriberri
Created July 17, 2014 10:40
Show Gist options
  • Save iriberri/1310e871f8407e4d5317 to your computer and use it in GitHub Desktop.
Save iriberri/1310e871f8407e4d5317 to your computer and use it in GitHub Desktop.
CartoDB.js visualisation options
<html>
<head>
<title>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"/>
<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" />
</head>
<body>
<div id="map" style="height: 400px; width:400px"></div>
<!-- include cartodb.js library -->
<script src="http://libs.cartocdn.com/cartodb.js/v3/cartodb.js"></script>
<script>
function main() {
cartodb.createVis('map', 'http://iriberri.cartodb.com/api/v2/viz/xxxxx-xxxxx-xxxx-xxxx-xxxxxxxxxx/viz.json', {
center_lat: 43.90,
center_lon: -97.55,
zoom: 5
})
.done(function(vis, layers) {
layers[1].setInteraction(true);
layers[1].on('featureOver', function(e, pos, latlng, data) {
cartodb.log.log(e, pos, latlng, data);
});
map = vis.getNativeMap();
})
.error(function(err) {
console.log(err);
});
}
window.onload = main;
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment