Created
August 21, 2018 22:02
-
-
Save mejackreed/a125c46db512cb4c1f4de64b53b52533 to your computer and use it in GitHub Desktop.
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>Add a WMS source</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.46.0/mapbox-gl.js'></script> | |
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.46.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> | |
mapboxgl.accessToken = 'pk.eyJ1IjoibWVqYWNrcmVlZCIsImEiOiJLSUo2a0pZIn0.uo-4b21vBKQ5A24_AaHFUg'; | |
var map = new mapboxgl.Map({ | |
container: 'map', | |
style: 'mapbox://styles/mapbox/light-v9', | |
zoom: 13, | |
center: [-0.09,51.505] | |
}); | |
self.addEventListener('fetch', function(event) { | |
console.log(event) | |
}); | |
map.on('load', function() { | |
map.addLayer( | |
{ | |
'id': 'wms-test-layer', | |
'type': 'raster', | |
'source': { | |
'type': 'raster', | |
'tiles': [ | |
'https://geowebservices.stanford.edu/geoserver/druid/wms?service=WMS&version=1.3.0&request=GetMap&bbox={bbox-epsg-3857}&layers=druid:tn694kr3170&styles=&width=256&height=256&srs=EPSG:3857&format=image/png' | |
], | |
'tileSize': 256 | |
}, | |
'paint': {'raster-fade-duration': 0} | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment