Skip to content

Instantly share code, notes, and snippets.

@andreaangeli
Created April 24, 2016 14:48
Show Gist options
  • Save andreaangeli/1356ee049ec761317e51751b81055b5e to your computer and use it in GitHub Desktop.
Save andreaangeli/1356ee049ec761317e51751b81055b5e to your computer and use it in GitHub Desktop.
Leaflet Map with Default Marker
<!DOCTYPE html>
<html>
<head>
<title>Leaflet Web Map</title>
<!-- reference to Leaflet CSS -->
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<!-- reference to Leaflet JavaScript -->
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<!-- set width and height styles for map -->
<style>
#map {
width: 960px;
height:500px;
}
</style>
</head>
<body>
<!-- place holder for map -->
<div id="map"></div>
<script>
// create map object, tell it to live in 'map' div and give initial latitude, longitude, zoom values
var map = L.map('map', {scrollWheelZoom:false}).setView([43.64701, -79.39425], 15);
// add base map tiles from OpenStreetMap and attribution info to 'map' div
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
// create marker object, add to map at point specified
var marker = L.marker([43.64701, -79.39425]).addTo(map);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment