Commit 6cda0a55 authored by ZettaScript's avatar ZettaScript

Add map layers

parent a41a660b
......@@ -81,7 +81,8 @@ a, a:visited {
<div id="header-text">
<h1>WorldWotMap</h1>
<a href="#map">&#11015; Voir la map &#11015;</a>
<p>WorldWotMap v0.1.1, &copy; 2018 <a href="https://zettascript.org/contact.php">Pascal Engélibert</a> (<a href="https://www.gnu.org/licenses/agpl.html">Licence GNU AGPL v3</a>) (<a href="https://framagit.org/ZettaScript/worldwotmap/">dépôt Git</a>)</p>
<p>WorldWotMap v0.1.1, &copy; 2018 <a href="https://zettascript.org/contact.php">Pascal Engélibert</a> (<a href="https://www.gnu.org/licenses/agpl.html">Licence GNU AGPL v3</a>)<br />
Dépôts Git&nbsp;: <a href="https://framagit.org/ZettaScript/worldwotmap/">Framagit</a> et <a href="https://git.duniter.org/tuxmain/worldwotmap">Duniter</a></p>
<p>Ceci est une carte affichant les comptes Ğ1 et leurs certifications. La carte peut être incomplète, car il est facultatif de renseigner sa position géographique sur Cesium+.</p>
<a href="gencache.py">Programme Python pour exporter les données de duniter.db</a>
</div>
......@@ -159,6 +160,15 @@ var ncerts = 0;
var active_account = null;
var map = L.map("map").setView([46.725, 2.834], 6);
L.tileLayer('https://{s}.tile.osm.org/{z}/{x}/{y}.png', {attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'}).addTo(map);
var l_accounts_cert = L.layerGroup();
var l_accounts_wallet = L.layerGroup();
var l_certlines = L.layerGroup();
var overlayMaps = {
"Identités": l_accounts_cert,
"Porte-feuilles": l_accounts_wallet,
"Certifications": l_certlines
};
L.control.layers({}, overlayMaps).addTo(map);
//$.post("https://g1.data.duniter.fr/user/profile/_search", '{"query":{"bool":{"must":[{"exists":{"field":"geoPoint"}}]}},"from":1000,"size":1000,"_source":["title","geoPoint","avatar._content_type","address","city","description"]}', function(data) {
$.post("https://g1.data.duniter.fr/user/profile/_search", '{"query":{"bool":{"must":[{"exists":{"field":"geoPoint"}}]}},"from":0,"size":0,"_source":[]}', function(data) {
......@@ -178,18 +188,21 @@ $.post("https://g1.data.duniter.fr/user/profile/_search", '{"query":{"bool":{"mu
var account = new Account(account_data["_id"], account_data["_source"]["title"], [account_data["_source"]["geoPoint"]["lat"], account_data["_source"]["geoPoint"]["lon"]], account_data["_source"]["address"], account_data["_source"]["city"], point);
accounts[account_data["_id"]] = account;
point.on("popupopen", account.mapActiveAccount);
point.addTo(l_accounts_wallet);
}
$.get("duniterdb.json", null, function(data) {
for(id in data["ids"]) {
if(id in accounts) {
accounts[id].point.setStyle({color: "red", fillColor: "red"});
accounts[id].point.addTo(l_accounts_cert);
}
}
for(var i=0; i < data["certs"].length; i ++) {
if(data["certs"][i][0] in accounts && data["certs"][i][1] in accounts && data["certs"][i][3] == 0) {
var line = L.polyline([accounts[data["certs"][i][0]].pos, accounts[data["certs"][i][1]].pos], {color:'black', weight:1, opacity:0.3}).addTo(map);
line.bindPopup("<b>"+accounts[data["certs"][i][0]].title+"</b> &rarr; <b>"+accounts[data["certs"][i][1]].title+"</b>");
line.addTo(l_certlines);
certs.push(new Cert(data["certs"][i][0], data["certs"][i][1], line));
accounts[data["certs"][i][0]].certsIssued.push(ncerts);
accounts[data["certs"][i][1]].certsReceived.push(ncerts);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment