-
Notifications
You must be signed in to change notification settings - Fork 1
/
nomisma.html
132 lines (117 loc) · 3.81 KB
/
nomisma.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<html>
<head>
<title>British Library projects</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css" integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" crossorigin="" />
<link href="./leaflet.timeline.css" rel="stylesheet" type="text/css" />
<script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js" integrity="sha512-GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og==" crossorigin=""></script>
<script src="./IntervalTree.js"></script>
<script src="./Timeline.js"></script>
<script src="./TimelineSliderControl.js"></script>
<script src="./VisTimeline.js"></script>
<script src="./moment.min.js"></script>
<link href="./vis-timeline-graph2d.min.css" rel="stylesheet" type="text/css" />
<!-- <link href="./vis-timeline-graph2d.css" rel="stylesheet" type="text/css" /> -->
<script src="./vis-timeline-graph2d.min.js"></script>
<style>
html,
body {
margin: 0;
padding: 0;
}
#map {
width: 100vw;
height: 100vh;
}
.leaflet-bottom.leaflet-left {
width: 100%;
}
.leaflet-control-container .leaflet-timeline-controls {
box-sizing: border-box;
width: 100%;
margin: 0;
margin-bottom: 15px;
}
table,
th,
td {
background-color: white;
border: 5px solid black;
border-collapse: collapse;
height: 30px;
width: 100%;
padding: 0;
}
/* .vis-t {
height: 400px;
} */
/* .vis-panel {
width: 10%;
} */
.leaflet-control.leaflet-timeline-control input[type=range] {
width: 91%;
margin-left: 9%;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
// function getColorFor(str) { // java String#hashCode
// var hash = 0;
// for (var i = 0; i < str.length; i++) {
// hash = str.charCodeAt(i) + ((hash << 5) - hash);
// }
// var red = (hash >> 24) & 0xff;
// var grn = (hash >> 16) & 0xff;
// var blu = (hash >> 8) & 0xff;
// return 'rgb(' + red + ',' + grn + ',' + blu + ')';
// }
var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
var osmAttrib = '© <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors';
var osm = L.tileLayer(osmUrl, {
maxZoom: 18,
attribution: osmAttrib
});
var map = L.map('map', {
layers: [osm],
center: new L.LatLng(18.3, 73.5),
zoom: 2
});
var timeline;
var timelineControl;
function onLoadData(data) {
timeline = L.timeline(data, {
style: function(data) {
return {
stroke: false,
// color: getColorFor(data.properties.name),
color: 'black',
fillOpacity: 0.5
}
},
waitToUpdateMap: true,
onEachFeature: function(feature, layer) {
if (feature.properties.name) layer.bindTooltip(feature.properties.name);
if (feature.properties.link) layer.bindPopup('Click here <a href="' + feature.properties.link + '">' + feature.properties.link + '</a>' );
if (feature.properties.institution) layer.bindPopup(feature.properties.institution);
}
});
timelineControl = L.timelineSliderControl({
formatOutput: function(date) {
date = new Date(date)
var day = date.getDate();
var monthIndex = date.getMonth();
var year = date.getFullYear();
return `${day}/${monthIndex}/${year}`
},
enableKeyboardControls: true,
});
timeline.addTo(map);
timelineControl.addTo(map);
timelineControl.addTimelines(timeline);
createVisTimeline(data, 'histogram');
}
</script>
<script src="./data/nomisma.geojson"></script>
</body>
</html>