Irish Heritage
Below is a map showing the 675,000 people with Irish heritage throughout British Columbia. Data was collected at the dissemination area level, or the smallest census level available. Find your neighbourhood, and see how Irish it is!
var map = L.map('irish-heritage-map').setView([54.5, -124.9], 5);
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', { maxZoom: 18, attribution: 'Map data © OpenStreetMap contributors, ' + 'CC-BY-SA, ' + 'Imagery © Mapbox', id: 'mapbox.light' }).addTo(map);
// control that shows state info on hover var info = L.control();
info.onAdd = function (map) { this._div = L.DomUtil.create('div', 'info'); this.update(); return this._div; };
info.update = function (props) { this._div.innerHTML = '
People of Irish Heritage
' + (props ? '' + props.IRISH : 'Hover over an area'); };
info.addTo(map);
// get color depending on population density value function getColor(d) { return d > 495 ? '#006D20' : d > 230 ? '#31A354' : d > 120 ? '#74C476' : d > 55 ? '#BAE4B3' : d > 0 ? '#EDF8E9' : '#FFFFFF'; }
function style(feature) { return { weight: 0, opacity: 1, color: 'white', dashArray: '3', fillOpacity: 0.4, fillColor: getColor(feature.properties.IRISH) }; }
function highlightFeature(e) { var layer = e.target;
layer.setStyle({ weight: 2, color: '#666', dashArray: '', fillOpacity: 0.7 });
if (!L.Browser.ie && !L.Browser.opera && !L.Browser.edge) { layer.bringToFront(); }
info.update(layer.feature.properties); }
var geojson;
function resetHighlight(e) { geojson.resetStyle(e.target); info.update(); }
function zoomToFeature(e) { map.fitBounds(e.target.getBounds()); }
function onEachFeature(feature, layer) { layer.on({ mouseover: highlightFeature, mouseout: resetHighlight, click: zoomToFeature }); }
geojson = L.geoJson(bcirish, { style: style, onEachFeature: onEachFeature }).addTo(map);
map.attributionControl.addAttribution('Population data © Canadian Census 2016');
var legend = L.control({position: 'bottomright'});
legend.onAdd = function (map) {
var div = L.DomUtil.create('div', 'info legend'), grades = [0, 55, 120, 230, 500], labels = [], from, to;
for (var i = 0; i < grades.length; i++) { from = grades[i]; to = grades[i + 1]; labels.push( ' ' + from + (to ? '–' + to : '+')); }
div.innerHTML = labels.join('
');
return div;
};
legend.addTo(map);