Last active
December 17, 2015 08:18
-
-
Save wboykinm/5578714 to your computer and use it in GitHub Desktop.
BISON WMS
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> | |
<script src='http://api.tiles.mapbox.com/mapbox.js/v1.0.2/mapbox.js'></script> | |
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.0.2/mapbox.css' rel='stylesheet' /> | |
<!--[if lte IE 8]> | |
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.0.2/mapbox.ie.css' rel='stylesheet' > | |
<![endif]--> | |
<style> | |
body { margin:0; padding:0; } | |
#map { position:absolute; top:0; bottom:0; width:100%; } | |
</style> | |
</head> | |
<body> | |
<style> | |
#map-ui { | |
position:absolute; | |
top:10px;right:10px; | |
z-index:100; | |
} | |
#map-ui ul { | |
list-style:none; | |
margin:0;padding:0; | |
} | |
#map-ui a { | |
font-size:13px; | |
background:#FFF; | |
color:#3C4E5A; | |
display:block; | |
margin:0;padding:0; | |
border:1px solid #BBB; | |
border-bottom-width:0; | |
min-width:138px; | |
padding:10px; | |
text-decoration:none; | |
} | |
#map-ui a:hover { background:#ECF5FA; } | |
#map-ui li:last-child a { | |
border-bottom-width:1px; | |
-webkit-border-radius:0 0 3px 3px; | |
border-radius:0 0 3px 3px; | |
} | |
#map-ui li:first-child a { | |
-webkit-border-radius:3px 3px 0 0; | |
border-radius:3px 3px 0 0; | |
} | |
#map-ui a.active { | |
background:#3887BE; | |
border-color:#3887BE; | |
color:#FFF; | |
} | |
#map-ui li:last-child a.active { | |
border-top-color:#FFF; | |
} | |
</style> | |
<div id='map' class='dark'> | |
<div id='map-ui'> | |
<ul> | |
<li><a href='#' class='active' id='bluejays'>Blue Jay</a></li> | |
<li><a href='#' class='' id='geese'>Canada Goose</a></li> | |
</ul> | |
</div> | |
</div> | |
<script> | |
var map = L.mapbox.map('map', 'landplanner.map-wev6g4fo') | |
.setView([44.2668,-72.4699], 10); | |
var bluejays = L.tileLayer.wms("http://bisonapi.usgs.ornl.gov/api/wms?", { | |
format: 'image/png', | |
transparent: true, | |
layers : 'species', | |
transparent : "true", | |
species : "blue jay", | |
type : "common_name" | |
}).addTo(map); | |
var geese = L.tileLayer.wms("http://bisonapi.usgs.ornl.gov/api/wms?", { | |
format: 'image/png', | |
transparent: true, | |
layers : 'county', | |
transparent : "true", | |
species : "Canada Goose", | |
type : "common_name" | |
}).addTo(map); | |
// Layer switcher | |
document.getElementById('bluejays').onclick = function () { | |
var enable = this.className !== 'active'; | |
bluejays.setOpacity(enable ? 1 : 0); | |
this.className = enable ? 'active' : ''; | |
return false; | |
}; | |
document.getElementById('geese').onclick = function () { | |
var enable = this.className !== 'active'; | |
geese.setOpacity(enable ? 1 : 0); | |
this.className = enable ? 'active' : ''; | |
return false; | |
}; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment