Skip to content

Instantly share code, notes, and snippets.

@ekala
Last active August 22, 2016 09:40
Show Gist options
  • Save ekala/ee9fb4adf9c49d16cb25 to your computer and use it in GitHub Desktop.
Save ekala/ee9fb4adf9c49d16cb25 to your computer and use it in GitHub Desktop.
A map of all the countries BRCKs have been shipped to
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>BRCK shipments</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.5/leaflet.css" />
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="http://cdn.leafletjs.com/leaflet-0.7.5/leaflet.js"></script>
<script type="text/javascript" src="./shipments.geojson"></script>
<style media="screen" type="text/css">
body { margin: 0; padding: 0; }
html, body, #map {
height: 100%;
width: 100%;
}
</style>
</head>
<body>
<div id="map">
</div>
<script type="text/javascript">
var map = L.map('map').setView([-1.28333, 36.8166700], 4);
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {
attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>',
minZoom: 2,
maxZoom: 18,
id: 'ekala.ng7ikmo3',
accessToken: 'pk.eyJ1IjoiZWthbGEiLCJhIjoiY2llcHZtcnVpMDAzdncwa21seThwNTRmMCJ9.wRLb2Ufq6Q0BD63n7z49Dg'
}).addTo(map);
L.geoJson(shipments, {
style: function(feature) {
if (feature.properties.fill !== undefined) {
return {
color: feature.properties.fill,
fillOpacity: feature.properties['fill-opacity']
};
}
return null;
}
}).addTo(map);
</script>
</body>
</html>
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment