Newer
Older
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
//git URL that will be used to import the layers
const git = 'https://raw.githubusercontent.com/' + gitName + '/europe_maps/master/polygones.json';
const gitPersonnes = 'https://raw.githubusercontent.com/' + gitName + '/europe_maps/master/personne.json';
const gitSouv = 'https://raw.githubusercontent.com/' + gitName + '/europe_maps/master/link.json';
const gitEvents = 'https://raw.githubusercontent.com/' + gitName + '/europe_maps/master/event.json';
function importMap() {
if (appMode) hideImportExport();
let s = window.location.href;
let url = new URL(s);
//Si l'utilisateur a tenté d'importé une année
let request = new XMLHttpRequest();
//Ajout de chaque polygone
try {
request.open('GET', git, true);
request.onload = function () {
// Convert JSON data to an object
window.features = JSON.parse(this.response);
//Parcours des polygones, appel de la fonction onEachFeature
L.geoJson(window.features, {
onEachFeature: onEachFeature
});
refreshDisplay();
}
request.send();
} catch {
console.log("An unknown error has been fired");
}
}
function importPersonnes() {
if (appMode) hideImportExport();
let s = window.location.href;
let url = new URL(s);
//Si l'utilisateur a tenté d'importé une année
let request = new XMLHttpRequest();
//Ajout de chaque polygone
try {
request.open('GET', gitPersonnes, true);
request.onload = function () {
// Convert JSON data to an object
window.listePersonnes = JSON.parse(this.response);
createJsonGlobal(window.listePersonnes);
}
request.send();
} catch {
console.log("An unknown error has been fired");
}
}
function importSouverainete() {
if (appMode) hideImportExport();
let s = window.location.href;
let url = new URL(s);
//Si l'utilisateur a tenté d'importé une année
let request = new XMLHttpRequest();
//Ajout de chaque polygone
try {
request.open('GET', gitSouv, true);
request.onload = function () {
// Convert JSON data to an object
window.souverainete = JSON.parse(this.response);
}
request.send();
} catch {
console.log("An unknown error has been fired");
}
}
function importEvents() {
if (appMode) hideImportExport();
let s = window.location.href;
let url = new URL(s);
//Si l'utilisateur a tenté d'importé une année
let request = new XMLHttpRequest();
//Ajout de chaque polygone
try {
request.open('GET', gitEvents, true);
request.onload = function () {
// Convert JSON data to an object
window.events = JSON.parse(this.response);
}
request.send();
} catch {
console.log("An unknown error has been fired");
}
}