Skip to content

Instantly share code, notes, and snippets.

@case
Last active June 26, 2016 21:28
Show Gist options
  • Save case/d00f938e56d80ceba3b66e23ff22f6a6 to your computer and use it in GitHub Desktop.
Save case/d00f938e56d80ceba3b66e23ff22f6a6 to your computer and use it in GitHub Desktop.
WWSD #1: Leaflet starter
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
#map {
height: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
var map = L.map('map').setView([30, 0], 2);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
// add Places layer
// var urlPlaces = "http://enjalot.github.io/wwsd/data/world/ne_50m_populated_places_simple.geojson";
// d3.json(urlPlaces, function(err, data) {
// // console.log("data:", data);
// L.geoJson(data).addTo(map);
// });
// add Rivers layer
// var urlRivers = "http://enjalot.github.io/wwsd/data/world/ne_50m_rivers_lake_centerlines.geojson";
// d3.json(urlRivers, function(err, data) {
// L.geoJson(data).addTo(map);
// });
// add Countries layer
// var urlCountries = "http://enjalot.github.io/wwsd/data/world/ne_50m_admin_0_countries.geojson";
// d3.json(urlCountries, function(err, data) {
// L.geoJson(data).addTo(map);
// });
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment