Skip to content

Instantly share code, notes, and snippets.

@javisantana
Created February 28, 2013 17:52
Show Gist options
  • Save javisantana/5058684 to your computer and use it in GitHub Desktop.
Save javisantana/5058684 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<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.js"></script>
<script>
function main() {
cartodb.createVis('map', 'http://examples.cartodb.com/api/v1/viz/european_countries_e/viz.json', {
shareable: true,
title: true,
description: true,
search: true,
tiles_loader: true,
center_lat: 0,
center_lon: 0,
zoom: 2
})
.done(function(vis, layers) {
// layer 0 is the base layer, layer 1 is cartodb layer
layers[1].on('featureOver', function(e, pos, latlng, data) {
cartodb.log.log(e, pos, latlng, data);
});
// you can get the native map to work with it
// depending if you use google maps or leaflet
map = vis.getNativeMap();
map.scrollWheelZoom.disable()
// map.setZoom(3)
// map.setCenter(new google.maps.Latlng(...))
})
.error(function(err) {
console.log(err);
});
}
window.onload = main;
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment