Debian Codegraph @

example/geojson.html

raw ◀ ▶
1 Debian patch touch this file
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Leaflet debug page</title>
5
•6 <link rel="stylesheet" href="/usr/share/javascript/leafletleaflet.css" integrity="sha512-07I2e+7D8p6he1SIM+1twR5TIrhUQn9+I6yjqD53JQjFiMf8EtC93ty0/5vJTZGF8aAocvHYNEDJajGdNx1IsQ==" crossorigin="" />
7 <script src="/usr/share/javascript/leafletleaflet-src.js" integrity="sha512-WXoSHqw/t26DszhdMhOXOkI7qCiv5QWXhH9R7CgvgZMHz1ImlkVQ3uNsiQKu5wwbbxtPzFXd1hK4tzno2VqhpA==" crossorigin=""></script>
8 <meta name="viewport" content="width=device-width, initial-scale=1.0">
9 <link rel="stylesheet" href="screen.css" />
10
•11 <link rel="stylesheet" href="/usr/share/javascript/leaflet/MarkerCluster.css" />
12 <link rel="stylesheet" href="/usr/share/javascript/leaflet/MarkerCluster.Default.css" />
13 <script src="/usr/share/javascript/leaflet/leaflet.markercluster-src.js"></script>
14 </head>
15 <body>
16
17 <div id="map"></div>
18
19 <script type="text/javascript">
20
21 var geoJsonData = {
22 "type": "FeatureCollection",
23 "features": [
24 { "type": "Feature", "id":"1", "properties": { "address": "2" }, "geometry": { "type": "Point", "coordinates": [175.2209316333,-37.8210922667 ] } },
25 { "type": "Feature", "id":"2", "properties": { "address": "151" }, "geometry": { "type": "Point", "coordinates": [175.2238417833,-37.80975435 ] } },
26 { "type": "Feature", "id":"3", "properties": { "address": "21" }, "geometry": { "type": "Point", "coordinates": [175.2169955667,-37.818193 ] } },
27 { "type": "Feature", "id":"4", "properties": { "address": "14" }, "geometry": { "type": "Point", "coordinates": [175.2240856667,-37.8216963 ] } },
28 { "type": "Feature", "id":"5", "properties": { "address": "38B" }, "geometry": { "type": "Point", "coordinates": [175.2196982333,-37.8188702167 ] } },
29 { "type": "Feature", "id":"6", "properties": { "address": "38" }, "geometry": { "type": "Point", "coordinates": [175.2209942 ,-37.8192782833 ] } }
30 ]
31 };
32
33 var tiles = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
34 maxZoom: 18,
35 attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
36 });
37
38 var map = L.map('map')
39 .addLayer(tiles);
40
41 var markers = L.markerClusterGroup();
42
43 var geoJsonLayer = L.geoJson(geoJsonData, {
44 onEachFeature: function (feature, layer) {
45 layer.bindPopup(feature.properties.address);
46 }
47 });
48 markers.addLayer(geoJsonLayer);
49
50 map.addLayer(markers);
51 map.fitBounds(markers.getBounds());
52 </script>
53 </body>
54 </html>