Skip to content

Instantly share code, notes, and snippets.

@MichaelCPell
Created September 9, 2016 16:27
Show Gist options
  • Save MichaelCPell/86a3c99450a9171718a010ee17fcebb6 to your computer and use it in GitHub Desktop.
Save MichaelCPell/86a3c99450a9171718a010ee17fcebb6 to your computer and use it in GitHub Desktop.
var addMarker;
$(document).ready(function(){
var mymap = L.map('mapid').setView([35.7796, -78.6382], 13);
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpandmbXliNDBjZWd2M2x6bDk3c2ZtOTkifQ._QA7i5Mpkd_m30IGElHziw', {
maxZoom: 18,
attribution: 'Map data &copy; <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>',
id: 'mapbox.streets'
}).addTo(mymap);
addMarker = function(lat, lng){
latlng = {lat: lat, lng: lng};
L.marker(latlng).addTo(mymap);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment