-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
133 lines (124 loc) Β· 5.74 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
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
133
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<!-- http://leafletjs.com/examples/quick-start.html -->
<!-- http://cdn.leafletjs.com/leaflet/v0.7.7/ -->
<link rel="stylesheet" href="leaflet.css" type="text/css" />
<script src="leaflet.js" type="text/javascript">
//<![CDATA[
// http://cdn.leafletjs.com/leaflet/v0.7.7/
//]]>
</script>
<script src="gpx.js" type="text/javascript">
//<![CDATA[
// https://rawgit.com/mpetazzoni/leaflet-gpx/master/
//]]>
</script>
<!-- https://github.com/Leaflet/Leaflet.markercluster
http://gis.stackexchange.com/a/123068 -->
<link rel="stylesheet" href="./MarkerCluster.css" />
<link rel="stylesheet" href="./MarkerCluster.Default.css" />
<script src="./leaflet.markercluster-src.js"></script>
<title>Megalithic Ireland Maps</title>
<style type="text/css">
/*<![CDATA[*/
#mapdiv {
height: 95vh;
}
/*]]>*/
</style>
</head>
<body>
<div id="mapdiv"></div>
<script type="text/javascript">
//<![CDATA[
var map = null;
{
var centerGps = new L.LatLng(53.45862, -7.53662);
var zoom = 7;
var posMatch = window.location.href.match(/#map=(\d+)\/(-?\d+(?:\.\d+)?)\/(-?\d+(?:\.\d+)?)/);
if( posMatch ) {
centerGps = new L.LatLng(posMatch[2], posMatch[3]);
zoom = posMatch[1];
};
map = L.map('mapdiv', {center: centerGps, zoom: zoom});
map.on("moveend", function(e) {
// http://stackoverflow.com/a/21432964
var c = map.getCenter();
history.pushState(null, null, "#map=" + map.getZoom() + '/' + c.lat.toFixed(5) + '/' + c.lng.toFixed(5));
});
}
var osmAttr = '© <a href="http://openstreetmap.org">OpenStreetMap<\/a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA<\/a>';
// OpenStreetMap, the mother of all maps:
// map.addLayer(new L.TileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap.org, ' + 'Map data ' + osmAttr, maxZoom: 18 }));
// nice map, but distorted streetcorners:
// map.addLayer(new L.TileLayer('https://{s}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png', { attribution: '© Thunderforest.com, ' + 'Map data ' + osmAttr, maxZoom: 18 }));
// sadly no https β so the browser displays a 'security' warning:
// map.addLayer(new L.TileLayer('http://{s}.tiles.wmflabs.org/hikebike/{z}/{x}/{y}.png', { attribution: '© HikeBikeMap.org, ' + 'Map data ' + osmAttr, maxZoom: 18 }));
// the tiles load sloooowly sometimes, but the map is nice and supports https:
map.addLayer(new L.TileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', { attribution: '© OpenTopoMap, ' + 'Map data ' + osmAttr, maxZoom: 17 }));
// http://gis.stackexchange.com/a/123068
var markerClusters = new L.MarkerClusterGroup({maxClusterRadius: 50, chunkedLoading: true, polygonOptions: {stroke: false}});
// https://github.com/mpetazzoni/leaflet-gpx
// https://raw.githubusercontent.com/Megalithicirelandmap/Megalithicirelandmap.github.io/master/monuments.gpx
// ./monuments.gpx
new L.GPX('monuments.gpx', {
async: true,
gpx_options: { parseElements: ['waypoint'] },
marker_options: {
startIconUrl: null,
endIconUrl: null,
shadowUrl: null,
wptIconUrls: {
'subject#abbeys': 'poi-img/abbey.png',
'subject#castles': 'poi-img/tower house-castle.png',
'subject#holywells': 'poi-img/holy well.png',
'subject#stonecircles': 'poi-img/stone circle.png',
'': 'poi-img/sight-2.png',
//
'subject#bullauns': 'poi-img/megalith-ogham.png',
'subject#church': 'poi-img/church-cathedral-round tower.png',
'subject#courttombs': 'poi-img/megalith-ogham.png',
'subject#crossslabs': 'poi-img/cross-cross pillar.png',
'subject#cultstones': 'poi-img/megalith-ogham.png',
'subject#cross': 'poi-img/cross-cross pillar.png',
'subject#dovecote': 'poi-img/dovecote.png',
'subject#grave': 'poi-img/grave.png',
'subject#mottes': 'poi-img/motte-mound.png',
'subject#ogham': 'poi-img/megalith-ogham.png',
'subject#oratories': 'poi-img/oratory-tomb shrine-christian.png',
'subject#passagetombs': 'poi-img/megalith-ogham.png',
'subject#pilgrimagesites': 'poi-img/sight-other.png',
'subject#portaltombs': 'poi-img/megalith-ogham.png',
'subject#promontoryforts': 'poi-img/sight-other.png',
'subject#ringforts': 'poi-img/ring fort-rath.png',
'subject#rockart': 'poi-img/megalith-ogham.png',
'subject#roundtowers': 'poi-img/round tower.png',
'subject#sheelas': 'poi-img/sheela-na-gig.png',
'subject#standingstones': 'poi-img/megalith-ogham.png',
'subject#stonepairs': 'poi-img/megalith-ogham.png',
'subject#stonerows': 'poi-img/megalith-ogham.png',
'subject#walledtowns': 'poi-img/citywalls.png',
'subject#wedgetombs': 'poi-img/megalith-ogham.png',
'subject#windmill': 'poi-img/windmill.png',
},
iconSize: [32, 37],
// shadowSize: [50, 50],
iconAnchor: [16, 37],
// shadowAnchor: [16, 47]
}
});
// http://gis.stackexchange.com/a/123068
map.addLayer(markerClusters);
L.control.scale().addTo(map);
//]]>
</script>
<p id="explanation">POIs loaded directly from <a href="monuments.gpx"><tt>monuments.gpx</tt></a>,
Map <a href="http://mapicons.nicolasmollet.com/markers/">Icons by Nicolas
Mollet</a>. <a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons 3.0
BY-SA</a>.</p>
</body>
</html>