Examples on using CartoDB.js.
Adding a VizJSON to a Leaflet Map.
Examples on using CartoDB.js.
Adding a VizJSON to a Leaflet Map.
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title>Ejemplos IGN</title> | |
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<style> | |
html, body, #map { | |
height: 100%; | |
padding: 0; | |
margin: 0; | |
} | |
</style> | |
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/3.14/themes/css/cartodb.css" /> | |
<script src="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.14/cartodb.js"></script> | |
</head> | |
<body> | |
<div id="map"></div> | |
<script> | |
$( document ).ready(function() { | |
//Create the leaflet map | |
var map = L.map('map', { | |
zoomControl: true, | |
center: [39.583,2.670], | |
zoom: 12 | |
}); | |
// PNOA WMS | |
L.tileLayer.wms("http://www.ign.es/wms-inspire/pnoa-ma", { | |
layers: 'OI.OrthoimageCoverage', | |
format: 'image/jpeg', | |
transparent: false, | |
attribution: "IGN" | |
}).addTo(map); | |
//Add a CartoDB Layer | |
var viz = 'https://ignspaintest.cartodb.com/api/v2/viz/2d215c0c-08ff-11e5-9e8a-0e018d66dc29/viz.json'; | |
cartodb.createLayer(map, viz).addTo(map); | |
}); | |
</script> | |
</body> | |
</html> |