Skip to content

Instantly share code, notes, and snippets.

@calvinmetcalf
Forked from ramiroaznar/index.html
Last active August 9, 2016 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calvinmetcalf/fdd5515cec6138bd672a9d7dd0b46075 to your computer and use it in GitHub Desktop.
Save calvinmetcalf/fdd5515cec6138bd672a9d7dd0b46075 to your computer and use it in GitHub Desktop.
How to remove a CARTO layer interactivity + GMs
<!DOCTYPE html>
<html>
<head>
<title>GMs and CARTO.js | Remove interactivity</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="http://cartodb.com/assets/favicon.ico" />
<style>
html, body, #map {
height: 100%;
padding: 0;
margin: 0;
}
</style>
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/3.15/themes/css/cartodb.css" />
</head>
<body>
<div id="map"></div>
<!-- include google maps library + visualization-->
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=visualization"></script>
<!-- include cartodb.js library -->
<script src="http://libs.cartocdn.com.s3.amazonaws.com/cartodb.js/v3/3.15/cartodb.uncompressed.js"></script>
<script>
var map, sublayer;
function main() {
// Map center
var myOptions = {
zoom: 3,
center: new google.maps.LatLng(40, 0),
disableDefaultUI: true,
mapTypeId: google.maps.MapTypeId.SATELLITE
}
// Render basemap
map = new google.maps.Map(document.getElementById("map"), myOptions);
var urlLayer = "https://team.cartodb.com/u/ramirocartodb/api/v2/viz/d3b411a0-e521-11e5-bf3f-0e31c9be1b51/viz.json";
/* Add a layer to the map */
console.log("Add Layer");
cartodb.createLayer(map, urlLayer)
.addTo(map)
}
window.onload = main;
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment