Created
September 23, 2014 13:58
-
-
Save zross/81674207bf67244fedc0 to your computer and use it in GitHub Desktop.
GeoJSON data on Leaflet Map with MapBox tiles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" /> | |
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script> | |
<script src='https://api.tiles.mapbox.com/mapbox.js/v1.6.4/mapbox.js'></script> | |
<link href='https://api.tiles.mapbox.com/mapbox.js/v1.6.4/mapbox.css' rel='stylesheet' /> | |
<style> | |
html, | |
body { | |
height: 100%; | |
width: 100%; | |
} | |
body { | |
margin: 0; | |
} | |
#map { | |
width: 100%; | |
height: 100%; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="map"></div> | |
<script type="text/javascript"> | |
var mapboxTiles = L.tileLayer('https://{s}.tiles.mapbox.com/v3/examples.map-zr0njcqy/{z}/{x}/{y}.png', { | |
attribution: '<a href="http://www.mapbox.com/about/maps/" target="_blank">Terms & Feedback</a>' | |
}); | |
var map = L.map('map') | |
.addLayer(mapboxTiles) | |
.setView([40.724936, -73.991455], 16); | |
var line = L.mapbox.featureLayer() | |
.loadURL('line.geojson') | |
.addTo(map); | |
var points = L.mapbox.featureLayer() | |
.loadURL('points.geojson') | |
.addTo(map); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Excellent demo Zross. I download the source code but i get some issues. I include this example in my Xampp server and i get the follow errors:
24638.png:1 GET https://c.tiles.mapbox.com/v3/examples.map-zr0njcqy/16/19299/24638.png? 410 (Gone)