xxxxxxxxxx
<!--Example for: https://mapbox.com//blog/vector-tile-sandwich/-->
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<html>
<head>
<link href='https://api.tiles.mapbox.com/mapbox.js/v1.0.0/mapbox.css' rel='stylesheet' />
<script src='https://api.tiles.mapbox.com/mapbox.js/v1.0.0/mapbox.js'></script>
<script src='/rsudekum/5431771/example/nycneighborhoods.js'></script><!--Processing Steps https://gist.github.com/lxbarth/5452832-->
<style>
html,
body,
#map {
padding: 0;
margin: 0;
width: 100%;
height: 100%;
}
.leaflet-top-pane {
pointer-events: none;
}
</style>
</head>
<body>
<div id="map"></div>
<script type="text/javascript">
var map = L.mapbox.map('map').setView([40.75, -73.94], 15);
// Set base style of vector data
function style(feature) {
return {
weight: 0,
fillOpacity: 0.5,
fillColor: '#FFEDA0'
};
}
// Set hover colors
function highlightFeature(e) {
var layer = e.target;
layer.setStyle({
weight: 10,
opacity: 1,
color: '#09F',
dashArray: '3',
fillOpacity: 0.7,
fillColor: '#FEB24C'
});
}
// A function to reset the colors when a neighborhood is not longer 'hovered'
function resetHighlight(e) {
geojson.resetStyle(e.target);
}
// Tell MapBox.js what functions to call when mousing over and out of a neighborhood
function onEachFeature(feature, layer) {
layer.on({
mouseover: highlightFeature,
mouseout: resetHighlight
});
}
// Add vector data to map
geojson = L.geoJson(neighborhoods, {
style: style,
onEachFeature: onEachFeature
}).addTo(map);
// Here is where the magic happens: Manipulate the z-index of tile layers,
// this makes sure our vector data shows up above the background map and
// under roads and labels.
var topPane = map._createPane('leaflet-top-pane', map.getPanes().mapPane);
var topLayer = L.mapbox.tileLayer('landplanner.map-0wnm9063').addTo(map);
topPane.appendChild(topLayer.getContainer());
topLayer.setZIndex(7);
</script>
</body>
</html>
Modified http://api.tiles.mapbox.com/mapbox.js/v1.0.0/mapbox.js to a secure url
Updated missing url http://bl.ocks.org/rsudekum/raw/5431771/nycneighborhoods.js to /rsudekum/5431771/example/nycneighborhoods.js
https://api.tiles.mapbox.com/mapbox.js/v1.0.0/mapbox.js
https://bl.ocks.org/rsudekum/raw/5431771/nycneighborhoods.js