Skip to content

Instantly share code, notes, and snippets.

@knownasilya
Forked from zross/index.html
Last active September 3, 2015 20:51
Show Gist options
  • Save knownasilya/a922d79130ad2b7d4f7c to your computer and use it in GitHub Desktop.
Save knownasilya/a922d79130ad2b7d4f7c to your computer and use it in GitHub Desktop.
HTML: test infowindow with gmaps
<!DOCTYPE html>
<html>
<head>
<title>HTML5</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=650, user-scalable=yes">
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false">
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script src="http://libs.cartocdn.com/cartodb.js/v3/cartodb.js"></script>
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/themes/css/cartodb.css" />
<style>
html, body {
height: 100%;
margin: 0;
}
#map{
height:100%;
}
</style>
<script>
var map;
$(document).ready(function(){
var mapOptions = {
zoom: 6,
center: new google.maps.LatLng(37.9564, -121.3673),
mapTypeId: google.maps.MapTypeId.ROADMAP
//mapTypeId: google.maps.MapTypeId.TERRAIN
};
map = new google.maps.Map($('#map')[0], mapOptions);
// ----- Add the layer with the county information
cartodb.createLayer(map, 'https://appgeo.cartodb.com/u/clientdemos/api/v2/viz/e6279476-5276-11e5-86ac-0e018d66dc29/viz.json', {
infowindow: true
})
.on('done', function(layer) {
map.overlayMapTypes.setAt(200, layer);
var sublayer = layer.getSubLayer(0);
sublayer.setInteraction(true); // It looks like this is not necessary
cdb.vis.Vis.addInfowindow(map, sublayer, ['cartodb_id','assetcode']);
});
});//end document ready
</script>
</head>
<body>
<div id="map">
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment