Skip to content

Instantly share code, notes, and snippets.

@wboykinm
Last active March 15, 2016 02:29
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 wboykinm/efc65b3672f7f21594e0 to your computer and use it in GitHub Desktop.
Save wboykinm/efc65b3672f7f21594e0 to your computer and use it in GitHub Desktop.
Places where coordinate order doesn't matter.
<!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.15.0/mapbox-gl.js'></script>
<script src='//api.tiles.mapbox.com/mapbox.js/plugins/turf/v2.0.0/turf.min.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.15.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id='map'></div>
<script>
// spec the map
mapboxgl.accessToken = 'pk.eyJ1IjoibGFuZHBsYW5uZXIiLCJhIjoicUtlZGgwYyJ9.UFYz8MD4lI4kIzk9bjGFvg';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/landplanner/cilsqlj1b00aza7ltg9c7so0f',
center: [25,25],
zoom: 4,
pitch: 60,
bearing: 0
});
map.addControl(new mapboxgl.Navigation());
// function to create all points
var buildPoints = function() {
var sites = [];
for (i = -90; i < 90; i++) {
sites.push(turf.point([i,i]));
};
return turf.featurecollection(sites);
};
map.on('style.load', function() {
var fc = buildPoints();
map.addSource("markers", {
"type": "geojson",
"data": fc
});
map.addLayer({
"id": "markers",
"type": "symbol",
"source": "markers",
"layout": {
"icon-image": "motorway_1"
}
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment