Created
July 10, 2015 13:20
-
-
Save AlanPew/460b936e924ecfa293d1 to your computer and use it in GitHub Desktop.
javascript test
This file contains 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
<!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.8.1/mapbox-gl.js'></script> | |
<script src='maps.js'></script> | |
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.8.1/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> | |
mapboxgl.accessToken = 'dontneedatokenwithothermaps'; | |
var map = new mapboxgl.Map({ | |
container: 'map', | |
style: simple, | |
zoom: 1, | |
center: [35, -14] | |
}); | |
map.addControl(new mapboxgl.Navigation()); | |
</script> | |
</body> | |
</html> |
This file contains 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 simple = { | |
"version": 7, | |
"constants": { | |
"@land": "#41afa5", | |
"@water": "#3887be", | |
"@ocean": "#ffffff" | |
}, | |
"sources": { | |
"osm": { | |
"type": "vector", | |
"tiles": ["https://vector.mapzen.com/osm/all/{z}/{x}/{y}.mapbox"] | |
}, | |
"test": { | |
"type": "vector", | |
"tiles": ["http://tile.openstreetmap.us/vectiles-water-areas/{z}/{x}/{y}.mvt"] | |
} | |
}, | |
"layers": [{ | |
"id": "background", | |
"type": "background", | |
"paint": { | |
"background-color": "@land" | |
} | |
}, { | |
"id": "water", | |
"type": "fill", | |
"source": "osm", | |
"source-layer": "water", | |
"paint": { | |
"fill-color": "@water" | |
} | |
},{ | |
"id": "river", | |
"source": "osm", | |
"source-layer": "water", | |
"type": "line", | |
"min-zoom": 6, | |
"filter": ["all", ["==", "$type", "LineString"], ["==", "kind", "river"]], | |
"layout": { | |
"line-cap": "round", | |
"line-join": "round" | |
}, | |
"paint": { | |
"line-color": "@water", | |
"line-width": { | |
"base": 1.2, | |
"stops": [[8, 0.75], [20, 15]] | |
} | |
} | |
}, | |
{ | |
"id": "water-polygon", | |
"source": "osm", | |
"source-layer": "water", | |
"type": "fill", | |
"filter": ["all",["==", "$type", "Polygon"],["==", "kind", "ocean"]], | |
"paint": { | |
"fill-color": "@ocean" | |
} | |
}] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment