Last active
August 28, 2017 12:05
-
-
Save alasarr/2c10dbd8c10476db678d7a7194cc6006 to your computer and use it in GitHub Desktop.
CARTO Mapnik reserved word
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 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: [40.445379415215285, -3.416748046875], | |
zoom: 10, | |
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: 'posterscope-admin', | |
type: 'cartodb', | |
sublayers: [{ | |
sql: `select cartodb_id,id,source,the_geom_webmercator,hashtag from | |
alasarr_xy_social_map_point('alasarr','<token>', | |
st_transform(st_makeenvelope(-180,-85,180,85,4326),3857),'madrid', | |
array['twitter','instagram'],'2017-01-01','2018-01-01',array[1,2],array['inhash'],array['excludehash']) | |
`, | |
cartocss: ` | |
#layer { | |
marker-fill-opacity: 1; | |
[source='twitter'] { | |
marker-width: 18; | |
marker-file: url('https://s3.amazonaws.com/com.cartodb.users-assets.production/production/posterscope-admin/assets/20170619093051icon-twitter.svg'); | |
} | |
[source='instagram'] { | |
marker-width: 15; | |
marker-file: url('https://s3.amazonaws.com/com.cartodb.users-assets.production/production/posterscope-admin/assets/20170823170118instagram.svg'); | |
} | |
marker-allow-overlap: false; | |
marker-line-width: 1; | |
marker-line-color: #FFF; | |
marker-line-opacity: 1; | |
}` | |
}] | |
}, {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