-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
159 lines (133 loc) · 4.57 KB
/
index.html
File metadata and controls
159 lines (133 loc) · 4.57 KB
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!DOCTYPE html>
<html>
<head>
<title>Roadtripkartan</title>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
<link rel="stylesheet" type="text/css" href="index.css" />
<script src="./marker.js"></script>
<script src="./input.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tabletop.js/1.5.1/tabletop.min.js"></script>
<script type="text/javascript">
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return "";
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
var publicSpreadsheetUrl =
"https://docs.google.com/spreadsheets/d/" +
getParameterByName("id") +
"/edit?usp=sharing";
function init() {
Tabletop.init({
key: publicSpreadsheetUrl,
callback: loadDataCallback,
simpleSheet: false,
});
}
function loadDataCallback(data, tabletop) {
tabletop.foundSheetNames.forEach((sheet) => {
loadFromGoogleSheets(data[sheet].elements, sheet);
var $button = $(
`<input type="button" class="copyMarkerCoordinates" value="${sheet}" />`
);
$button.appendTo($("#coordinateButtons"));
});
finishedLoadingData();
}
window.addEventListener("DOMContentLoaded", init);
</script>
<link
rel="stylesheet"
href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css"
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
crossorigin=""
/>
<script
src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js"
integrity="sha512-GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og=="
crossorigin=""
></script>
<link
rel="stylesheet"
href="./leaflet-control-geocoder/dist/Control.Geocoder.css"
/>
<script src="./leaflet-control-geocoder/dist/Control.Geocoder.js"></script>
<link
rel="stylesheet"
href="./Leaflet.markercluster-1.4.1/dist/MarkerCluster.css"
/>
<link
rel="stylesheet"
href="./Leaflet.markercluster-1.4.1/dist/MarkerCluster.Default.css"
/>
<script src="./Leaflet.markercluster-1.4.1/dist/leaflet.markercluster.js"></script>
</head>
<body>
<h1>Roadtripkartan</h1>
<p>
Ladda upp från fil:
</p>
<input type="file" id="file" onchange="startRead()" />
<div id="info-section"></div>
<div id="warning-section" style="display: none;">
<p>
<strong>Warning!</strong> The following addresses could not be located:
</p>
<div id="warning-list"></div>
</div>
<div id="map"></div>
<div id="categoryButtons">
<input
type="button"
class="showAllCategories"
value="Visa alla kategorier"
/>
</div>
<script>
var map = L.map("map").setView([55.5, 7.5], 4);
var geocoder = L.Control.Geocoder.nominatim(),
control = L.Control.geocoder({
geocoder: geocoder,
}).addTo(map),
marker;
const mapBoxAccessToken = "pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw";
L.tileLayer(
`https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=${mapBoxAccessToken}`,
{
maxZoom: 18,
attribution:
'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
id: "mapbox/streets-v11",
}
).addTo(map);
</script>
<hr />
<div id="coordinateButtons">
Kopiera koordinater
<br />
Välj flik:
<br />
</div>
<hr />
<p>
Open Source! Source code available at:
<a href="https://github.com/Sundin/GeoMapper"
>https://github.com/Sundin/GeoMapper</a
>
</p>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="./coordinates.js"></script>
<script src="./buttons.js"></script>
</body>
</html>