Skip to content

Instantly share code, notes, and snippets.

Created August 24, 2017 02:26
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 anonymous/ffc54aa42f9dc2d76b4d73fff594b041 to your computer and use it in GitHub Desktop.
Save anonymous/ffc54aa42f9dc2d76b4d73fff594b041 to your computer and use it in GitHub Desktop.
fresh block
license: mit
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.39.1/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.39.1/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
.marker {
background-image: url('./icons/svgs/marker-15.svg');
background-size: cover;
width: 15px;
height: 15px;
cursor: pointer;
}
</style>
</head>
<body>
<div id='map'></div>
<script>
mapboxgl.accessToken = 'pk.eyJ1IjoibWFwdGFzdGlrIiwiYSI6IjNPMkREV1kifQ.2KGPFZD0QaGfvYzXYotTXQ';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/maptastik/cj6my6c0x083o2qnsdv3bewpx',
center: [-73.284431,42.357363],
zoom: 16,
pitch: 45
});
map.on('load', function () {
map.addSource('poi', {
'type': 'geojson',
'data': 'poi.geojson'
})
map.addLayer({
'id': 'poi',
'type': 'symbol',
'source': 'poi',
'layout': {
'icon-image': '{icon}-15',
'text-field': '{title}',
'text-font': ["Open Sans Semibold", "Arial Unicode MS Bold"],
'text-offset': [0, 0.6],
'text-anchor': 'top'
},
'paint': {
'text-halo-color': '#fff',
'text-halo-width': 1
}
});
});
</script>
</body>
</html>
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment