-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
271 lines (268 loc) · 9.99 KB
/
script.js
File metadata and controls
271 lines (268 loc) · 9.99 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
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
// Sample data to demonstrate functionality (replace with real data)
const data = [
{
"POTEAU_ID_POT": 7444,
"POSITION_POP": 7,
"PANNEAU_ID_PAN": 13565,
"PANNEAU_ID_RPA": 2604,
"DESCRIPTION_RPA": "\\P 09h30-10h30 MER. 1 MARS AU 1 DEC.",
"CODE_RPA": "SU-ND",
"FLECHE_PAN": 0,
"TOPONYME_PAN": "Main Street",
"DESCRIPTION_CAT": "STATIONNEMENT",
"POTEAU_VERSION_POT": 0,
"DATE_CONCEPTION_POT": "1999-11-05",
"PAS_SUR_RUE": null,
"DESCRIPTION_REP": "Enlevé",
"DESCRIPTION_RTP": "1- Tige et base",
"Longitude": -73.571238,
"Latitude": 45.547944,
"NOM_ARROND": "Rosemont - La Petite-Patrie",
"Latrine": "Yes",
"Township": "Libore",
"Status": "No",
"Electricity": "No",
"Internet": "No",
"ConstructionMaterial": "Mix",
"Water": "No",
"Fencing": "No",
"Library": "No",
"ConnectionSpeed": "N/A",
"Boys": "N/A",
"TeachingStaff": "N/A",
"PhoneNumber": "N/A",
"Girls": "N/A",
"TotalStudents": "N/A",
"ComputerRoom": "No",
"MobileNetwork": "No"
},
{
"POTEAU_ID_POT": 7444,
"POSITION_POP": 7,
"PANNEAU_ID_PAN": 13565,
"PANNEAU_ID_RPA": 2604,
"DESCRIPTION_RPA": "\\P 09h30-10h30 MER. 1 MARS AU 1 DEC.",
"CODE_RPA": "SU-ND",
"FLECHE_PAN": 0,
"TOPONYME_PAN": "Main Street",
"DESCRIPTION_CAT": "STATIONNEMENT",
"POTEAU_VERSION_POT": 0,
"DATE_CONCEPTION_POT": "1999-11-05",
"PAS_SUR_RUE": null,
"DESCRIPTION_REP": "Enlevé",
"DESCRIPTION_RTP": "1- Tige et base",
"Longitude": -73.571238,
"Latitude": 45.547944,
"NOM_ARROND": "Rosemont - La Petite-Patrie",
"Latrine": "Yes",
"Township": "Libore",
"Status": "No",
"Electricity": "No",
"Internet": "No",
"ConstructionMaterial": "Mix",
"Water": "No",
"Fencing": "No",
"Library": "No",
"ConnectionSpeed": "N/A",
"Boys": "N/A",
"TeachingStaff": "N/A",
"PhoneNumber": "N/A",
"Girls": "N/A",
"TotalStudents": "N/A",
"ComputerRoom": "No",
"MobileNetwork": "No"
},
{
"POTEAU_ID_POT": 59640,
"POSITION_POP": 6,
"PANNEAU_ID_PAN": 121656,
"PANNEAU_ID_RPA": 2420,
"DESCRIPTION_RPA": "\\P 09h-17h LUN. JEU.",
"CODE_RPA": "SD-ZD",
"FLECHE_PAN": 0,
"TOPONYME_PAN": "Second Street",
"DESCRIPTION_CAT": "STATIONNEMENT",
"POTEAU_VERSION_POT": 0,
"DATE_CONCEPTION_POT": "1999-09-24",
"PAS_SUR_RUE": null,
"DESCRIPTION_REP": "Enlevé",
"DESCRIPTION_RTP": "4- Poteau en bois",
"Longitude": -73.587793,
"Latitude": 45.474864,
"NOM_ARROND": "Le Sud-Ouest",
"Latrine": "Yes",
"Township": "Libore",
"Status": "No",
"Electricity": "No",
"Internet": "No",
"ConstructionMaterial": "Mix",
"Water": "No",
"Fencing": "No",
"Library": "No",
"ConnectionSpeed": "N/A",
"Boys": "N/A",
"TeachingStaff": "N/A",
"PhoneNumber": "N/A",
"Girls": "N/A",
"TotalStudents": "N/A",
"ComputerRoom": "No",
"MobileNetwork": "No"
},
{
"POTEAU_ID_POT": 62627,
"POSITION_POP": 7,
"PANNEAU_ID_PAN": 127071,
"PANNEAU_ID_RPA": 2686,
"DESCRIPTION_RPA": "\\P 07h30-08h30 LUN. AU VEN. 1 MARS AU 1 DEC.",
"CODE_RPA": "SV-AE",
"FLECHE_PAN": 0,
"TOPONYME_PAN": "Third Street",
"DESCRIPTION_CAT": "STATIONNEMENT",
"POTEAU_VERSION_POT": 2,
"DATE_CONCEPTION_POT": null,
"PAS_SUR_RUE": null,
"DESCRIPTION_REP": "Enlevé",
"DESCRIPTION_RTP": "2- Tige et manchon",
"Longitude": -73.576569,
"Latitude": 45.499245,
"NOM_ARROND": "Ville-Marie",
"Latrine": "Yes",
"Township": "Libore",
"Status": "No",
"Electricity": "No",
"Internet": "No",
"ConstructionMaterial": "Mix",
"Water": "No",
"Fencing": "No",
"Library": "No",
"ConnectionSpeed": "N/A",
"Boys": "N/A",
"TeachingStaff": "N/A",
"PhoneNumber": "N/A",
"Girls": "N/A",
"TotalStudents": "N/A",
"ComputerRoom": "No",
"MobileNetwork": "No"
},
{
"POTEAU_ID_POT": 60326,
"POSITION_POP": 6,
"PANNEAU_ID_PAN": 122960,
"PANNEAU_ID_RPA": 2175,
"DESCRIPTION_RPA": "\\P 09h-17h MAR. VEN.",
"CODE_RPA": "SB-JL",
"FLECHE_PAN": 2,
"TOPONYME_PAN": "Fourth Street",
"DESCRIPTION_CAT": "STATIONNEMENT",
"POTEAU_VERSION_POT": 1,
"DATE_CONCEPTION_POT": null,
"PAS_SUR_RUE": null,
"DESCRIPTION_REP": "Réel",
"DESCRIPTION_RTP": "3- Fût",
"Longitude": -73.58679,
"Latitude": 45.628754,
"NOM_ARROND": "Rivière-des-Prairies - Pointe-aux-Trembles",
"Latrine": "Yes",
"Township": "Libore",
"Status": "No",
"Electricity": "No",
"Internet": "No",
"ConstructionMaterial": "Mix",
"Water": "No",
"Fencing": "No",
"Library": "No",
"ConnectionSpeed": "N/A",
"Boys": "N/A",
"TeachingStaff": "N/A",
"PhoneNumber": "N/A",
"Girls": "N/A",
"TotalStudents": "N/A",
"ComputerRoom": "No",
"MobileNetwork": "No"
},
{
"POTEAU_ID_POT": 60327,
"POSITION_POP": 6,
"PANNEAU_ID_PAN": 122961,
"PANNEAU_ID_RPA": 2176,
"DESCRIPTION_RPA": "\\P 09h-17h MAR. VEN.",
"CODE_RPA": "SB-JL",
"FLECHE_PAN": 2,
"TOPONYME_PAN": "Fifth Street",
"DESCRIPTION_CAT": "STATIONNEMENT",
"POTEAU_VERSION_POT": 1,
"DATE_CONCEPTION_POT": null,
"PAS_SUR_RUE": null,
"DESCRIPTION_REP": "Réel",
"DESCRIPTION_RTP": "3- Fût",
"Longitude": -73.58680,
"Latitude": 45.628755,
"NOM_ARROND": "Rivière-des-Prairies - Pointe-aux-Trembles",
"Latrine": "Yes",
"Township": "Libore",
"Status": "No",
"Electricity": "No",
"Internet": "No",
"ConstructionMaterial": "Mix",
"Water": "No",
"Fencing": "No",
"Library": "No",
"ConnectionSpeed": "N/A",
"Boys": "N/A",
"TeachingStaff": "N/A",
"PhoneNumber": "N/A",
"Girls": "N/A",
"TotalStudents": "N/A",
"ComputerRoom": "No",
"MobileNetwork": "No"
}
// Add more entries here...
];
// Initialize the map and set its view to the first point
const map = L.map('map').setView([data[0].Latitude, data[0].Longitude], 10);
// Add a tile layer to the map
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
// Add markers to the map
data.forEach(item => {
const marker = L.marker([item.Latitude, item.Longitude]).addTo(map);
const popupContent = `
<div class="popup-content">
<div class="popup-header">
<i class="fas fa-map-marker-alt"></i>
<h3>${item.NOM_ARROND}</h3>
</div>
<table class="popup-table">
<tr><td><i class="fas fa-map-marker-alt"></i> Latitude</td><td>${item.Latitude}</td></tr>
<tr><td><i class="fas fa-map-marker-alt"></i> Longitude</td><td>${item.Longitude}</td></tr>
<tr><td><i class="fas fa-globe"></i> Region</td><td>${item.NOM_ARROND}</td></tr>
<tr><td><i class="fas fa-map-signs"></i> Position</td><td>${item.POSITION_POP}</td></tr>
<tr><td><i class="fas fa-calendar-alt"></i> Date</td><td>${item.DATE_CONCEPTION_POT}</td></tr>
<tr><td><i class="fas fa-info-circle"></i> Description</td><td>${item.DESCRIPTION_RTP}</td></tr>
</table>
<table class="popup-table">
<tr><td><i class="fas fa-toilet"></i> Latrine</td><td>${item.Latrine}</td></tr>
<tr><td><i class="fas fa-city"></i> Township</td><td>${item.Township}</td></tr>
<tr><td><i class="fas fa-info-circle"></i> Status</td><td>${item.Status}</td></tr>
<tr><td><i class="fas fa-bolt"></i> Electricity</td><td>${item.Electricity}</td></tr>
<tr><td><i class="fas fa-wifi"></i> Internet</td><td>${item.Internet}</td></tr>
<tr><td><i class="fas fa-building"></i> Construction Material</td><td>${item.ConstructionMaterial}</td></tr>
<tr><td><i class="fas fa-water"></i> Water</td><td>${item.Water}</td></tr>
</table>
<table class="popup-table">
<tr><td><i class="fas fa-fence"></i> Fencing</td><td>${item.Fencing}</td></tr>
<tr><td><i class="fas fa-book"></i> Library</td><td>${item.Library}</td></tr>
<tr><td><i class="fas fa-tachometer-alt"></i> Connection Speed</td><td>${item.ConnectionSpeed}</td></tr>
<tr><td><i class="fas fa-male"></i> Boys</td><td>${item.Boys}</td></tr>
<tr><td><i class="fas fa-chalkboard-teacher"></i> Teaching Staff</td><td>${item.TeachingStaff}</td></tr>
<tr><td><i class="fas fa-phone"></i> Phone Number</td><td>${item.PhoneNumber}</td></tr>
<tr><td><i class="fas fa-female"></i> Girls</td><td>${item.Girls}</td></tr>
<tr><td><i class="fas fa-user-graduate"></i> Total Students</td><td>${item.TotalStudents}</td></tr>
<tr><td><i class="fas fa-desktop"></i> Computer Room</td><td>${item.ComputerRoom}</td></tr>
<tr><td><i class="fas fa-mobile-alt"></i> Mobile Network</td><td>${item.MobileNetwork}</td></tr>
</table>
</div>
`;
marker.bindPopup(popupContent);
});