On Github perliedman / maptime-gbg-201602
Per Liedman, Dotnet Mentor
I will assume some knowledge of HTML, JavaScript and object oriented programming.<html>
<head>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
</head>
<body>
<div id="map">
</div>
</body>
</html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
<style>
body {
padding: 0;
margin: 0;
}
#map {
position: absolute;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="map">
</div>
</body>
</html>
var map = L.map('map');
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors'
}).addTo(map);
var map = L.map('map');
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors'
}).addTo(map);
map.setView([57.7, 11.96], 13);
new L.LatLng(57.7, 11.9)
// ...is the same as
L.latLng(57.7, 11.9)
// ...and also the same as
[57.7, 11.9]
// ...but not as
[11.9, 57.7]
var geojson = {"type": "Point", "coordinates": [57.7, 11.9]};
L.geoJson(geojson).addTo(map);