Last active
December 28, 2015 11:49
-
-
Save smit1678/7495836 to your computer and use it in GitHub Desktop.
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 /> | |
<title>GeoJSON Marker from URL</title> | |
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' /> | |
<script src='//api.tiles.mapbox.com/mapbox.js/v1.4.2/mapbox.js'></script> | |
<link href='//api.tiles.mapbox.com/mapbox.js/v1.4.2/mapbox.css' rel='stylesheet' /> | |
<style> | |
body { margin:0; padding:0; } | |
#map { position:absolute; top:0; bottom:0; width:100%; } | |
#output { | |
position: absolute; | |
top: 10px; | |
right: 10px; | |
padding: 10px; | |
background: #fff; | |
z-index: 100; | |
} | |
</style | |
</style> | |
</head> | |
<body> | |
<div id='output'> | |
click: <code id='click'></code><br/> | |
mousemove: <code id='mousemove'></code><br/> | |
</div> | |
<div id='map'></div> | |
<script> | |
var map = L.mapbox.map('map', 'examples.map-9ijuk24y') | |
.setView([0, 0], 2); | |
// As with any other AJAX request, this technique is subject to the Same Origin Policy: | |
// http://en.wikipedia.org/wiki/Same_origin_policy | |
// So the CSV file must be on the same domain as the Javascript, or the server | |
// delivering it should support CORS. | |
var markerLayer = L.mapbox.markerLayer() | |
.loadURL('unosat-damaged-structures.geojson') | |
.addTo(map); | |
var click = document.getElementById('click'), | |
mousemove = document.getElementById('mousemove'); | |
var map = L.mapbox.map('map', 'examples.map-20v6611k'); | |
map.on('mousemove click', function(e) { | |
window[e.type].innerHTML = e.containerPoint.toString() + ', ' + e.latlng.toString(); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment