Last active
December 14, 2015 23:47
-
-
Save darrenjaworski/be8a5ff7c3cbe22356fb to your computer and use it in GitHub Desktop.
leaflet image overlay
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> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="x-ua-compatible" content="ie=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.css" /> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script> | |
<style> | |
body { | |
margin: 0; | |
} | |
#map { | |
position: absolute; | |
top: 0; | |
bottom: 0; | |
left: 0; | |
right: 0; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="map"> | |
</div> | |
<script> | |
var mapboxProjectID = 'darrenjaworski.n120ogj4', | |
accessToken = 'pk.eyJ1IjoiZGFycmVuamF3b3Jza2kiLCJhIjoiZmQ4OTYyNzJjYzc0OThiZTFjMmViMDE3ZmI0NTJmOTgifQ.3XwMxZz97E3nuPEZLoxohw'; | |
var map = L.map('map') | |
.setView([35.467560, -97.516428], 16); | |
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', { | |
attribution: 'Map data © <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: 15, | |
id: mapboxProjectID, | |
accessToken: accessToken | |
}).addTo(map); | |
var imageUrl = 'http://darrenjaworski.com/images/p180.png', | |
imageBounds = [[35.4770, -97.5255], [35.4615, -97.5083]]; | |
L.imageOverlay(imageUrl, imageBounds).addTo(map); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment