-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcambrils_S21417.html
191 lines (161 loc) · 9.48 KB
/
cambrils_S21417.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
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" href="./icons/pstop.png">
<link rel="shortcut icon" href="./icons/pstop.png">
<!-- Leaflet's CSS -->
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha512-puBpdR0798OZvTTbP4A8Ix/l+A4dHDD0DGqYW6RQ+9jxkRFclaxxQb/SJAWZfWAkuyeQUytO7+7N4QKrDh+drA=="
crossorigin=""/>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/leaflet.extra-markers.min.css">
<!-- Leaflet's JS -->
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"
integrity="sha512-QVftwZFqvtRNi0ZyCtsznlKSWOStnDORoefr1enyq5mVL4tmKB3S/EnC3rRJcxCPavG10IcrVGSmPh6Qw5lwrg=="
crossorigin=""></script>
<script src="js/leaflet-providers.js"></script>
<script src="https://unpkg.com/[email protected]/src/s2geometry.js"
integrity="sha384-WGDofm6Km+bZIxd/uBU2QJlwIMxX/9H5H7G9glfYtcAAR8vrm0wbzvtpIG54XhOZ"
crossorigin=""></script>
<style>html, body, #map {height:100%;width:100%;padding:0px;margin:0px;}</style>
</head>
<body>
<div id="map"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/tabletop.js/1.3.5/tabletop.min.js'></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/assets/js/leaflet.extra-markers.min.js"></script>
<script>
var lati = '41.069829'; // mataro 41.539188,2.444976 - masnou 41.482539, 2.325211
var logi = '1.055040'; // cambrils 41.069829, 1.055040
var southWest = L.latLng(lati, logi),
northEast = L.latLng(lati, logi);
//bounds = L.latLngBounds(southWest, northEast);
const bounds = L.latLngBounds(southWest, northEast);
var map = L.map('map').setView([lati, logi], 16);
// tileLayer examples --- https://leaflet-extras.github.io/leaflet-providers/preview/
L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
maxZoom: 18, //16,
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ',
id: 'mapbox.streets'
}).addTo(map);
//var marker = L.marker([lati, logi]).addTo(map);
//var marker = L.marker([lati, logi]).addTo(map),
//marker = L.circle([lati, logi], 200).addTo(map);
let ipokestop = L.ExtraMarkers.icon ({
icon: "fa-dice-d6",markerColor: "cyan",shape: "circle", prefix: "fas"
}); // Icono Pokeparada
let ipropuesta = L.ExtraMarkers.icon ({
// icon: "fa-tools",markerColor: "orange",shape: "square", prefix: "fas"
// icon: 'fa-spinner',
icon: 'fa-cog',
shape: 'circle',
markerColor: 'blue-dark',
prefix: 'fa',
extraClasses: 'fa-spin'
}); // Icono Propuesta
let igym = L.ExtraMarkers.icon ({
icon: "fa-egg",markerColor: "yellow",shape: "penta", prefix: "fas"
}); // Icono Gimnasio
let igymex = L.ExtraMarkers.icon ({
icon: "fa-star",markerColor: "yellow",shape: "star", prefix: "fas" ,extraClasses: 'fa-pulse'
}); // Icono Gim ex
let iaceptada = L.ExtraMarkers.icon ({
icon: "fa-thumbs-up",markerColor: "green-light",shape: "circle", prefix: "fas"
}); // Icono aceptada
let isugerencia = L.ExtraMarkers.icon ({
icon: "fa-hand-point-down",markerColor: "black",shape: "circle", prefix: "fas"
}); // Icono sugerencia
//function cargarMapa(){
var code = "1rRcKbQqjrIVVVFO1smLvdVg-UrYrQ88ck0chL-I0Fss"
// "11NuCbN1bKx9MZ6jx412OyRvBqb0l7k0ppFpmkDejIxc"
Tabletop.init({
key: code,
callback: function(sheet, tabletop){
$.each( tabletop.sheets("gym").all(), function(i, gim) {
var loc = [gim.latitude, gim.longitude]
marker = new L.Marker(new L.latLng(loc), {title: gim.nombre, icon: igym} );
marker.bindPopup("<h2><strong style='color: #ff8800'>" + gim.nombre + "<br>" + "</h2>" + gim.city + "</strong></h2>" +
" <h3><a href='http://maps.google.com/maps?q=" +gim.latitude+","+gim.longitude+ "'>" + gim.latitude+", "+gim.longitude + "</a></h3>" +
"<div id='infoboxpic'><div id='infoboxpicin'><div id='infoboxpicimg' style='background-image: url(" +gim.imagen + ");'></div></div></div>");
map.addLayer(marker);
})
$.each( tabletop.sheets("pokestop").all(), function(i, pokestop) {
var loc = [pokestop.latitude, pokestop.longitude]
marker2 = new L.Marker(new L.latLng(loc), {title: pokestop.nombre, icon: ipokestop} );
marker2.bindPopup("<h2><strong style='color: #0044ff'>" + pokestop.nombre + "<br>" + "</h2>" + pokestop.city + "</strong></h2>" +
" <h3><a href='http://maps.google.com/maps?q=" +pokestop.latitude+","+pokestop.longitude+ "'>" + pokestop.latitude+", "+pokestop.longitude + "</a></h3>" +
"<div id='infoboxpic'><div id='infoboxpicin'><div id='infoboxpicimg' style='background-image: url(" + pokestop.imagen + ");'></div></div></div>");
map.addLayer(marker2);
})
$.each( tabletop.sheets("gymex").all(), function(i, gymex) {
var loc = [gymex.latitude, gymex.longitude]
marker3 = new L.Marker(new L.latLng(loc), {title: gymex.nombre, icon: igymex} );
marker3.bindPopup("<h2><strong style='color: #ffdd00'>" + gymex.nombre + "<br>" + "</h2>" + gymex.city + "</strong></h2>" +
" <h3><a href='http://maps.google.com/maps?q=" +gymex.latitude+","+gymex.longitude+ "'>" + gymex.latitude+", "+gymex.longitude + "</a></h3>" +
"<div id='infoboxpic'><div id='infoboxpicin'><div id='infoboxpicimg' style='background-image: url(" + gymex.imagen + ");'></div></div></div>");
map.addLayer(marker3);
})
$.each( tabletop.sheets("Propuesta").all(), function(i, propuesta) {
var loc = [propuesta.latitude, propuesta.longitude]
marker4 = new L.Marker(new L.latLng(loc), {title: propuesta.nombre, icon: ipropuesta} );
marker4.bindPopup("<h2><strong style='color: #44ff00'>" + propuesta.nombre + "<br>" + "</h2>" + propuesta.city + "</strong></h2>" +
" <h3><a href='http://maps.google.com/maps?q=" +propuesta.latitude+","+propuesta.longitude+ "'>" + propuesta.latitude+", "+propuesta.longitude + "</a></h3>" +
"<div id='infoboxpic'><div id='infoboxpicin'><div id='infoboxpicimg' style='background-image: url(" + propuesta.imagen + ");'></div></div></div>");
map.addLayer(marker4);
})
$.each( tabletop.sheets("Aceptadas").all(), function(i, aceptada) {
var loc = [aceptada.latitude, aceptada.longitude]
marker5 = new L.Marker(new L.latLng(loc), {title: aceptada.nombre, icon: iaceptada} );
marker5.bindPopup("<h2><strong style='color: #0044ff'>" + aceptada.nombre + "<br>" + "</h2>" + aceptada.city + "</strong></h2>" +
" <h3><a href='http://maps.google.com/maps?q=" +aceptada.latitude+","+aceptada.longitude+ "'>" + aceptada.latitude+", "+aceptada.longitude + "</a></h3>" +
"<div id='infoboxpic'><div id='infoboxpicin'><div id='infoboxpicimg' style='background-image: url(" + aceptada.imagen + ");'></div></div></div>");
map.addLayer(marker5);
})
$.each( tabletop.sheets("Sugerencia").all(), function(i, sugerencia) {
var loc = [sugerencia.latitude, sugerencia.longitude]
marker6 = new L.Marker(new L.latLng(loc), {title: sugerencia.nombre, icon: isugerencia} );
marker6.bindPopup("<h2><strong style='color: #444444'>" + sugerencia.nombre + "<br>" + "</h2>" + sugerencia.city + "</strong></h2>" +
" <h3><a href='http://maps.google.com/maps?q=" +sugerencia.latitude+","+sugerencia.longitude+ "'>" + sugerencia.latitude+", "+sugerencia.longitude + "</a></h3>" +
"<div id='infoboxpic'><div id='infoboxpicin'><div id='infoboxpicimg' style='background-image: url(" + sugerencia.imagen + ");'></div></div></div>");
map.addLayer(marker6);
})
},
wanted: [ "gym" , "pokestop" , "gymex" , "Propuesta" , "Aceptadas" , "Sugerencia" ],
debug: true
})
// cells s2
function showS2Cells(level, style, showNames) {
const size = L.CRS.Earth.distance(bounds.getSouthWest(), bounds.getNorthEast()) / 10000 + 1|0;
const count = 2 ** level * size >> 10;
function addPoly(cell) {
const shape = showNames ? "polygon" : "polyline";
const vertices = cell.getCornerLatLngs();
if (shape === "polyline") vertices.push(vertices[0]);
const poly = L[shape](vertices,
Object.assign({color: 'black', opacity: 0.5, weight: 1, fillOpacity: 0.0}, style));
if (showNames && cells) poly.bindTooltip(cellName(cell));
poly.addTo(map);
}
// add cells spiraling outward
let cell = S2.S2Cell.FromLatLng(bounds.getCenter(), level);
let steps = 1;
let direction = 0;
do {
for (let i = 0; i < 2; i++) {
for (let i = 0; i < steps; i++) {
addPoly(cell);
cell = cell.getNeighbors()[direction % 4];
}
direction++;
}
steps++;
} while (steps < count);
}
showS2Cells(17, {color: 'cyan', weight: 1});
showS2Cells(14, {color: 'black', weight: 2});
</script>
</body>
</html>