generated from HandsOnDataViz/leaflet-map-simple
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
54 lines (43 loc) · 2.02 KB
/
index.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<html>
<head>
<title>IowaRails</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8">
<!-- Load Leaflet code library: see http://leafletjs.com/download.html -->
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
crossorigin=""/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
crossorigin=""></script>
<!-- ajax script (.css) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!-- Position the map and title with Cascading Style Sheet (.css) -->
<style>
body { margin:0; padding:0; }
#map { position: absolute; top:0; bottom:0; right:0; left:0; }
#map-title { position: relative; margin-top: 10px; margin-left: 50px; float: left; background: white; border: 2px solid rgba(0,0,0,0.2); padding: 6px 8px; font-family: Helvetica; font-weight: bold; font-size: 24px; z-index: 800; }
</style>
</head>
<body>
<!-- Display the map and title with HTML division tags -->
<div id="map-title">Map of Iowa's Railroads</div>
<div id="map"></div>
<!-- Create the interactive map content with JavaScript (.js) -->
<script>
/* Set up the initial map center and zoom level */
var map = L.map('map', {
center: [41.928915, -93.405451], // EDIT coordinates to re-center map
zoom: 8, // EDIT from 1 (zoomed out) to 18 (zoomed in)
});
/* display basemap tiles -- see others at https://leaflet-extras.github.io/leaflet-providers/preview/ */
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap' }).addTo(map);
/* Display data from a geojson file */
$.getJSON("map.geojson",function(data){
L.geoJson(data).addTo(map);
});
/* Display a point marker with pop-up text */
</script>
</body>
</html>