Skip to content

Instantly share code, notes, and snippets.

@ramiroaznar
Last active April 13, 2016 08:46
Show Gist options
  • Save ramiroaznar/cf23c61ddbf8be930208ad664fc158bb to your computer and use it in GitHub Desktop.
Save ramiroaznar/cf23c61ddbf8be930208ad664fc158bb to your computer and use it in GitHub Desktop.
CreateVis with customized options
<!DOCTYPE html>
<html>
<head>
<title>CreateVis with customized options</title>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<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>
<!-- include cartodb css -->
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/3.15/themes/css/cartodb.css" />
<!-- include cartodb.js library -->
<script src="http://libs.cartocdn.com/cartodb.js/v3/3.15/cartodb.js"></script>
</head>
<body>
<!-- define a map object-->
<div id="map"></div>
<script>
function main() {
var options = {
search: true,
cartodb_logo: false,
mobile_layout: true,
shareable: true,
title: true
};
var vizJSON = "https://team.cartodb.com/u/ramirocartodb/api/v2/viz/93bc4e36-0151-11e6-b009-0e3ff518bd15/viz.json";
// add cartodb layer with one layer
cartodb.createVis('map', vizJSON, options)
.on('done', function(vis,layers) {
console.log(vis);
console.log(layers);
}).on('error', function() {
console.log("some error occurred");
});
}
// load main() function
window.onload = main;
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment