-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patholdindex.html
100 lines (94 loc) · 4.11 KB
/
oldindex.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>bordoray's insights (planisphere)</title>
<script src="https://unpkg.com/[email protected]/dist/maplibre-gl.js"></script>
<link
href="https://unpkg.com/[email protected]/dist/maplibre-gl.css"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://bootswatch.com/4/cosmo/bootstrap.min.css"
/>
</head>
<body>
<div style="padding:15px">
<script src="./json/rlinsight_data.js"></script>
<b>World Map as my Facebook said (Globe coming soon)</b><br>
<i>Data from Facebook Graph API, Basemap from Maptiler & Openstreetmap</i>
</div>
<!--to visualize your data:<br>
1. Get yout access_token <a href="https://developers.facebook.com/tools/explorer/?method=GET&path=me%3Ffields%3Did%2Cname&version=v2.11" target="_blank">here</a> <br>
2. paste your access token here → <input type="text" id="inputoken" value="your access token"><br>
3. <a href="#" onclick="visu()">VISUALIZE</a> -->
<div id="map" style="width: 100%; height: 700px"></div>
<div id="json"></div>
<script>
// const inbjson = JSON.parse("./json/rlfbinsight.json");
loadmap(inbjson);
function loadmap(inbjson) {
var popup = new maplibregl.Popup({ closeOnClick: false });
var map = new maplibregl.Map({
container: "map",
center: [50, 0],
zoom: 1.3,
// minZoom: 4,
interactive: true,
style: "https://api.maptiler.com/maps/05592018-659c-4f31-97d7-a25b34b47b8e/style.json?key=yhy9XyHzzmvrO4bEiJps",
});
map.addControl(new maplibregl.NavigationControl());
map.on("load", function () {
// sources
console.log(inbjson);
console.log("wait...");
setTimeout(function () {
map.addSource("inbounds", {
type: "geojson",
data: inbjson,
});
map.addLayer({
id: "places",
source: "inbounds",
type: "circle",
paint: {
"circle-radius": 3.5,
"circle-color": "#ff00aa",
"circle-opacity": 0.6,
},
});
}, 2000);
map.on("mousemove", function (e) {
var fe = map.queryRenderedFeatures(e.point, {
layers: ["places"],
});
if (fe.length) {
clon = fe[0].geometry.coordinates[0];
clat = fe[0].geometry.coordinates[1];
place_name = fe[0].properties.name;
popupcontent = place_name + "<br><table><tr>";
for (var j = 0; j < fe.length; j++) {
if (j < 3) {
var n = fe.length - j - 1;
img_url = fe[n].properties.img;
popupcontent +=
"<td> <img src='" +
img_url +
"'/> </td>";
}
}
popup
.setLngLat([clon, clat])
.setHTML(popupcontent + "</tr></table>")
.addTo(map);
} else {
popup.remove();
}
});
console.log("Done!");
});
}
</script>
</body>
</html>