Skip to content

Instantly share code, notes, and snippets.

@glenrobertson
Created October 10, 2012 21:41
Show Gist options
  • Save glenrobertson/3868636 to your computer and use it in GitHub Desktop.
Save glenrobertson/3868636 to your computer and use it in GitHub Desktop.
Leaflet Map with a marker
<!DOCTYPE html>
<html>
<head>
<title>Leaflet Markers</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.4.3/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.4.3/leaflet.ie.css" />
<![endif]-->
<script src="http://cdn.leafletjs.com/leaflet-0.4.3/leaflet.js"></script>
<style type="text/css">
html, body, #map {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script type="text/javascript">
var map = new L.Map('map'),
cloudmadeUrl = 'http://{s}.tile.cloudmade.com/1a1b06b230af4efdbb989ea99e9841af/997/256/{z}/{x}/{y}.png',
cloudmadeAttribution = 'Map data &copy; 2011 OpenStreetMap contributors, Imagery &copy; 2011 CloudMade';
map.setView(new L.LatLng(-41.2901, 174.8536), 12);
var baseLayer = new L.TileLayer(cloudmadeUrl, { attribution: cloudmadeAttribution});
baseLayer.addTo(map);
var marker = new L.Marker([-41.2901, 174.8536]);
marker.addTo(map);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment