Skip to content

Instantly share code, notes, and snippets.

@feomike
Last active August 5, 2016 15:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save feomike/6042244 to your computer and use it in GitHub Desktop.
Save feomike/6042244 to your computer and use it in GitHub Desktop.
mapbox.js wms example

this example demonstrates how to call a wms from the mapbox.js library. in this case we are using the national broadband map wms and displaying the low resolution data (techg_50_f2012) fiber footprint for june 2012 on a basemap.

<!DOCTYPE html>
<html>
<head>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<script src='//api.tiles.mapbox.com/mapbox.js/v1.3.1/mapbox.js'></script>
<link href='//api.tiles.mapbox.com/mapbox.js/v1.3.1/mapbox.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 type='text/javascript'>
var map = L.mapbox.map('map', 'examples.map-y7l23tes')
.setView([37, -99], 5);
//http://apps.fcc.gov/geoserver/fcc/techd_50_f2012/wms
//techd_50_f2012
//http://apps.fcc.gov/geoserver/fcc/techg_50_f2012/wms
//techg_50_f2012
var precipitation = L.tileLayer.wms("http://apps.fcc.gov/geoserver/fcc/techg_50_s2013/wms", {
format: 'image/png',
transparent: true,
layers: 'techg_50_s2013'
}).addTo(map);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment