mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-07-25 15:38:54 +00:00

Now that tile.openstreetmap.org supports HTTP/2 + HTTP/3 the old (a|b|c).tile.openstreetmap.org is no longer recommended. Use tile.openstreetmap.org directly is faster and will likely result in a better cache hit ratio. Signed-off-by: Grant Slater <git@firefishy.com> Signed-off-by: Grant Slater <git@firefishy.com>
39 lines
1.0 KiB
HTML
39 lines
1.0 KiB
HTML
<html>
|
|
<head>
|
|
<link rel="stylesheet" href="../../dist/leaflet.css" />
|
|
<link rel="stylesheet" href="../css/screen.css" />
|
|
|
|
|
|
<script src="../../dist/leaflet-src.js"></script>
|
|
</head>
|
|
<body>
|
|
|
|
<div id="map"></div>
|
|
|
|
|
|
<script>
|
|
//Init a map, and attempt a locate.
|
|
var map = L.map('map', {
|
|
center: [39.84, -96.591],
|
|
zoom: 4,
|
|
preferCanvas: true
|
|
}).locate();
|
|
|
|
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
|
}).addTo(map);
|
|
|
|
var vanillaLayer = new L.LayerGroup();
|
|
map.addLayer(vanillaLayer);
|
|
|
|
map.on('moveend',function(e) {
|
|
console.log('moveend fired.')
|
|
});
|
|
|
|
//For experiments using setRadius
|
|
var marker = L.circleMarker(map.getCenter(),{radius:30}).addTo(vanillaLayer);
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|