Skip to content

Instantly share code, notes, and snippets.

@jkeefe
Last active December 10, 2015 05:58
Show Gist options
  • Select an option

  • Save jkeefe/4391583 to your computer and use it in GitHub Desktop.

Select an option

Save jkeefe/4391583 to your computer and use it in GitHub Desktop.
Quick description on how I layered streets above the data, and used the water areas to obscure the offshore data(!) on maps for: http://project.wnyc.org/nyc-districting-revised/#. Note that this is just for one layer, not the two I use to toggle on the finished project.
// 'jkeefe.nyc-district-revised' is the mapbox.js name for the data I made in TileMill which
// resides here: https://tiles.mapbox.com/jkeefe/map/nyc-district-revised#12.00/40.7223/-73.9112
// 'jkeefe.map-bz4e2who' is the mapbox.js name for a map I made at mapbox.com. It's just a
// Mapbox Streets layer I tinkered with to make the streets have opacity (alpha) of 53.
// It lives here: https://tiles.mapbox.com/jkeefe/map/map-bz4e2who#14.00/40.7227/-73.9904
// The rest of this code I learned from the mapbox.js documentation: http://mapbox.com/mapbox.js/api/v0.6.7/
// Code:
// load the two maps above. the first one becomes data[0], the second data[1]
mapbox.load(['jkeefe.nyc-district-revised', 'jkeefe.map-bz4e2who'], function(data) {
map = mapbox.map('map');
// Add the +/- zoom buttons
map.ui.zoomer.add();
// add current districts to the map
map.addLayer(data[0].layer);
// add the streets layer on top, which I've lowered the opacity on at mapbox.com
map.addTileLayer(data[1].layer);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment