Last active
August 23, 2017 14:30
-
-
Save alasarr/88f0bc96b547b152abfc6607c737812c to your computer and use it in GitHub Desktop.
CARTO template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
<script src="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/cartodb.js"></script> | |
<link rel="stylesheet" href="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/themes/css/cartodb.css" /> | |
<link rel="stylesheet" href="main.css" /> | |
</head> | |
<body> | |
<div id="map"></div> | |
<script type="cartocss" id="cartocss"> | |
#layer { | |
marker-width: 7; | |
marker-fill: #27b0ff; | |
marker-fill-opacity: 0.9; | |
marker-allow-overlap: true; | |
marker-line-width: 1; | |
marker-line-color: #FFF; | |
marker-line-opacity: 1; | |
} | |
</script> | |
<script type="sql" id="cartosql"> | |
SELECT * FROM alasarr.telsa_supercharger | |
</script> | |
<script src="main.js"></script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#map { | |
height: 100%; | |
width: 100%; | |
position: relative; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var map = L.map('map', { | |
center: [ 36.08462129606931, -97.470703125], | |
zoom: 5, | |
layers: [ | |
L.tileLayer('https://cartodb-basemaps-{s}.global.ssl.fastly.net/{style}/{z}/{x}/{y}.png',{style: 'light_nolabels', zIndex: 0}) | |
] | |
}); | |
// add cartodb layer with one sublayer | |
cartodb.createLayer(map, { | |
user_name: 'alasarr', | |
type: 'cartodb', | |
sublayers: [{ | |
sql: document.getElementById('cartosql').innerHTML, | |
cartocss: document.getElementById('cartocss').innerHTML | |
}] | |
},{ https: true}) | |
.addTo(map) | |
.done(function(layer) { | |
console.log('Yeah!') | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment