-
Notifications
You must be signed in to change notification settings - Fork 38
/
map2.html
35 lines (32 loc) · 1.16 KB
/
map2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!DOCTYPE html>
<html>
<head>
<title>Leaflet Map</title>
<!-- External Stylesheets -->
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.4.0/dist/leaflet.css"/>
<!-- Add the Leaflet JavaScript library -->
<script src="https://unpkg.com/leaflet@1.4.0/dist/leaflet.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-ajax/2.1.0/leaflet.ajax.min.js"></script>
</head>
<body>
<!-- Our web map and content will go here -->
<div id="map" style="width: 900px; height: 600px"></div>
<script>
// Create variable to hold map element, give initial settings to map
var map = L.map('map', {
center: [44.56576, -123.27888],
zoom: 16
});
// Add OpenStreetMap tile layer to map element
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
// load GeoJSON from an external file
L.geoJson.ajax("assets/geog371.geojson", {
onEachFeature: function(feature, layer) {
layer.bindPopup(feature.properties.name);
}
}).addTo(map);
</script>
</body>
</html>