Skip to content

Instantly share code, notes, and snippets.

@maptastik
Created February 7, 2017 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maptastik/749ca67f1d96f896b1d4c58d7a1e7739 to your computer and use it in GitHub Desktop.
Save maptastik/749ca67f1d96f896b1d4c58d7a1e7739 to your computer and use it in GitHub Desktop.
Loading external GeoJSON (Promise Method): Boilerplate
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Starter map</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
<style>
body {
margin: 0;
padding: 0;
}
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
<script>
var map = L.map('map')
.setView([37.857507, -85.632935], 7);
var basemap = L.tileLayer('http://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> &copy; <a href="http://cartodb.com/attributions">CartoDB</a>',
subdomains: 'abcd',
maxZoom: 19
}).addTo(map);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment