-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPOI.sh
More file actions
448 lines (434 loc) · 30.2 KB
/
Copy pathPOI.sh
File metadata and controls
448 lines (434 loc) · 30.2 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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
#!/bin/bash
orange=`tput setaf 11`
bg_orange=`tput setab 178`
purple=`tput setaf 13`
Line=`tput smul`
bold=`tput bold`
black=`tput setaf 0`
red=`tput setaf 1`
green=`tput setaf 2`
yellow=`tput setaf 3`
blue=`tput setaf 4`
magenta=`tput setaf 5`
cyan=`tput setaf 6`
white=`tput setaf 15`
reset=`tput sgr0`
bg_red=`tput setab 1`
bg_green=`tput setab 2`
bg_white=`tput setab 7`
bg_blue=`tput setab 4`
lightblue=`tput setaf 45`
lightgreen=`tput setaf 46`
bleuetern=`tput setaf 45`
ilghtpurple=`tput setaf 33`
lightred=`tput setaf 161`
darkblue=`tput setaf 19`
dir=$(
cd -P -- "$(dirname -- "$0")" && pwd -P
)
cd "$dir" 2>&1 &>/dev/null
FileDate=$(echo $(date +%Y_%m_%d) | tr "/" "_")
while read -re linecsv
do
# NODE INFO + DATA
substringfields=$(echo "$linecsv" | awk -F'|' '{print $20}' )
#echo "$red$substringfields"
NodeTitle=$(echo -e "$linecsv" | awk -F'|' '{print $3}' | sed "s/title' => //g" | sed 's/^"//g' | sed "s/^'//g" | awk 'FNR == 1' | sed 's/&/et/g' | sed 's/->/→/g' | sed 's/<-/←/g' | sed 's/>/→/g' | sed 's/</←/g' )
#↓ ↑ ← →
echo -e "${white}---> \$NodeTitle ----- ------ ------ ------ ------> ${orange}$NodeTitle"
NodeID=$(echo -e "$linecsv" | awk -F'nid'\'' => '\''' '{print $2}' | awk -F'|' '{print $1}' | awk 'NF')
echo -e "${white}---> \$NodeID ----- ------ ------ ------ ------> ${orange}"$NodeID""
NodeVID=$(echo -e "$linecsv" | awk -F'vid'\'' => '\''' '{print $2}' | awk -F'|' '{print $1}' | awk 'NF')
echo -e "${white}---> \$NodeVID ----- ------ ------ ------ ------> ${orange}"$NodeVID""
Vuuid=$(echo -e "$linecsv" | awk -F'vuuid'\'' => '\''' '{print $2}' | awk -F'|' '{print $1}' | awk 'NF')
echo -e "${white}---> \$Vuuid ----- ------ ------ ------ ------> ${orange}"$Vuuid""
Date=$(echo -e "$linecsv" | awk -F'created'\'' => '\''' '{print $2}' | awk -F'|' '{print $1}' | awk 'NF')
echo -e "${white}---> \$Date ----- ------ ------ ------ ------> ${orange}"$Date""
RevisionTimestamp=$(echo -e "$linecsv" | awk -F'changed'\'' => '\''' '{print $2}' | awk -F'|' '{print $1}' | awk 'NF')
echo -e "${white}---> \$RevisionTimestamp ----- ------ ------ ------ ------> ${orange}"$RevisionTimestamp""
# F#cking Date on Mac OS X Darwin (Condition)
System=$(uname)
if [ "$System" == "Darwin" ]
then
echo "Date MAC OS X condition"
CreatedDatetmp=$(date -r $Date | sed 's/CET //g'| sed 's/UTC //g' | sed 's/CEST //g')
# KML DATE FORMAT
CreatedDate=$(date -jf"%a %b %e %H:%M:%S %Y" "$CreatedDatetmp" +"%Y-%m-%dT%H:%M:%S+01:00")
LastRevisionTimestamptmp=$(date -r $RevisionTimestamp | sed 's/CET //g'| sed 's/UTC //g' | sed 's/CEST //g')
# KML DATE FORMAT Last revision
LastRevisionTimestamp=$(date -jf"%a %b %e %H:%M:%S %Y" "$LastRevisionTimestamptmp" +"%Y-%m-%dT%H:%M:%S+01:00")
else
CreatedDatetmp=$(date -d @$Date | sed 's/CET //g'| sed 's/UTC //g' | sed 's/CEST //g')
# KML DATE FORMAT
CreatedDate=$(date -d "$CreatedDatetmp" +"%Y-%m-%dT%H:%M:%S+01:00")
LastRevisionTimestamptmp=$(date -d @$RevisionTimestamp | sed 's/CET //g'| sed 's/UTC //g' | sed 's/CEST //g')
# KML DATE FORMAT
LastRevisionTimestamp=$(date -d "$LastRevisionTimestamptmp" +"%Y-%m-%dT%H:%M:%S+01:00")
fi
echo -e "${white}---> \$CreatedDate ----- ------ ------ ------ ------> ${orange}"$CreatedDate""
echo -e "${white}---> \$LastRevisionTimestamp ----- ------ ------ ------ ------> ${orange}"$LastRevisionTimestamp""
substringfieldsGeom=$(echo "$linecsv" | awk -F'|' '{print $20}' | awk -F''\''geometry'\'' => '\''' '{print $2}' | awk -F''\''' '{print $1}' | awk 'NF' | geomet )
#
SRSID=$(echo -e "$substringfieldsGeom" | awk -F'\"name\": \"EPSG' '{print $2}' | awk -F''\"'' '{print $1}')
coordinates3857=$(echo -e "$substringfieldsGeom" | awk -F'coordinates\": ' '{print $2}' | awk -F', \"' '{print $1}' | tr -d '[]' )
echo -e "${white}---> \$coordinates3857 ----- ------ ------ ------ ------> ${orange}"$coordinates3857""
TypeGeom=$(echo -e "$substringfieldsGeom" | awk -F'"srid": ' '{print $2}' | awk -F'\"type\": \"' '{print $2}' | awk -F'\"' '{print $1}')
#echo -e "${white}---> \$TypeGeom ----- ------ ------ ------ ------> ${orange}"$TypeGeom""
TypeDePOI=$(echo -e "$substringfields" | awk -F'field_type_poi' '{print $2}' | awk -F'tid'\'' => '\''' '{print $2}'| awk -F''\''' '{print $1}' |awk 'NF')
echo -e "${white}---> \$TypeDePOI ----- ------ ------ ------ ------> ${orange}"$TypeDePOI""
#'field_type_de_consolidation' => array( 'und' => array( array( 'tid' => '183'
TypeDInscription=$(echo -e "$linecsv" | awk -F'field_type_de_consolidation' '{print $2}' | awk -F'tid'\'' => '\''' '{print $2}' | awk -F''\'',' '{print $1}' |awk 'NF' | awk '{print $1}')
echo -e "${white}---> \$TypeDInscription (tid) ----- ------ ------ ------ ------> "$TypeDInscription""
coordinates4326=$(echo "$coordinates3857"| gdaltransform -s_srs EPSG:3857 -t_srs EPSG:4326 | sed 's/\ /\,/g')
echo -e "${white}---> \$coordinates4326 ----- ------ ------ ------ ------> ${orange}"$coordinates4326""
body=$(printf "$substringfields" | tr -d '\n'| awk -F'body' '{print $2}' | awk -F'value'\'' => "' '{print $2}' | awk -F'", '\''summary'\'' =>' '{print $1}' | sed 's/<p/\
<p/'g | sed 's/<\/p/\
<\/p/'g | sed 's/<span/\
<span/'g | sed 's/<\/span/\
<\/span/'g| sed 's/<div/\
<div/'g| sed 's/<br/\
<br/'g| sed 's/<\/div/\
<\/div/'g | sed 's/>/>\
/'g | sed 's/ //g' | sed 's/<br \/>/\
<br \/>/'g | sed 's/<br \/>//g' | awk '!/<span/' | awk '!/<\/span/' | awk '!/<p/'| awk '!/<\/p/'| awk '!/<\/div/'| awk '!/<div/' | awk 'NF'|awk '!/^[[:blank:]]*$/')
echo -e "---> \$body ------ ------ ------ ------ ------> "$body""
if [[ "$TypeDePOI" == 311 ]]
then
TypeDePOIsABC=$(echo -e "Lieu dit")
IconAPOI=$(echo "https://raw.githubusercontent.com/babinet/InOutNOutIn/main/Img/LD.png")
echo -e "${white}---> Type de P.O.I : ${orange}Lieu dit"
StyleKml="LD"
fi
if [[ "$TypeDePOI" == 310 ]]
then
TypeDePOIsABC=$(echo -e "Puits à eau")
IconAPOI=$(echo "https://raw.githubusercontent.com/babinet/InOutNOutIn/main/Img/PE.png")
StyleKml="PE"
echo -e "${white}---> Type de P.O.I : ${orange}Puits à eau"
fi
if [[ "$TypeDePOI" == 305 ]]
then
TypeDePOIsABC=$(echo -e "Abri")
IconAPOI=$(echo "https://raw.githubusercontent.com/babinet/InOutNOutIn/main/Img/A.png")
StyleKml="A"
echo -e "${white}---> Type de P.O.I : ${orange}Abri"
fi
if [[ "$TypeDePOI" == 306 ]]
then
TypeDePOIsABC=$(echo -e "Curiosité")
IconAPOI=$(echo "https://raw.githubusercontent.com/babinet/InOutNOutIn/main/Img/CRs.png")
StyleKml="CRs"
echo -e "${white}---> Type de P.O.I : ${orange}Curiosité"
fi
if [[ "$TypeDePOI" == 302 ]]
then
TypeDePOIsABC=$(echo -e "Inscription premier niveau")
IconAPOI=$(echo "https://raw.githubusercontent.com/babinet/InOutNOutIn/main/Img/ISc1.png")
StyleKml="ISc1"
echo -e "${white}---> Type de P.O.I : ${orange}Inscription premier niveau"
fi
if [[ "$TypeDePOI" == 303 ]]
then
TypeDePOIsABC=$(echo -e "Inscription deuxième niveau")
IconAPOI=$(echo "https://raw.githubusercontent.com/babinet/InOutNOutIn/main/Img/ISc2.png")
StyleKml="ISc2"
echo -e "${white}---> Type de P.O.I : ${orange}Inscription deuxième niveau"
fi
if [[ "$TypeDePOI" == 304 ]]
then
TypeDePOIsABC=$(echo -e "Inscription troisième niveau")
IconAPOI=$(echo "https://raw.githubusercontent.com/babinet/InOutNOutIn/main/Img/ISc3.png")
StyleKml="ISc3"
echo -e "${white}---> Type de P.O.I : ${orange}Inscription troisième niveau"
fi
InspecteurName=$(echo -e "$substringfields" | awk -F'field_inspecteur' '{print $2}' | awk -F'tid'\'' => '\''' '{print $2}'| awk -F''\''' '{print $1}' |awk 'NF')
# Inspecteurs / Architectes
if [[ "$InspecteurName" == 139 ]]; then Achitecte=$(echo -e "François Mansart"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
elif [[ "$InspecteurName" == 312 ]]; then Achitecte=$(echo -e "Antoine Dupont"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
elif [[ "$InspecteurName" == 92 ]]; then Achitecte=$(echo -e "Charles-Axel Guillaumot"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
elif [[ "$InspecteurName" == 96 ]]; then Achitecte=$(echo -e "Duchemin"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
elif [[ "$InspecteurName" == 98 ]]; then Achitecte=$(echo -e "Demoustier"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
elif [[ "$InspecteurName" == 99 ]]; then Achitecte=$(echo -e "Bralle"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
elif [[ "$InspecteurName" == 103 ]]; then Achitecte=$(echo -e "Commission"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
elif [[ "$InspecteurName" == 93 ]]; then Achitecte=$(echo -e "Héricart de Thury"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
elif [[ "$InspecteurName" == 105 ]]; then Achitecte=$(echo -e "Trémery"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
elif [[ "$InspecteurName" == 107 ]]; then Achitecte=$(echo -e "Juncker"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
elif [[ "$InspecteurName" == 110 ]]; then Achitecte=$(echo -e "Lorieux"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
elif [[ "$InspecteurName" == 102 ]]; then Achitecte=$(echo -e "Blavier"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
elif [[ "$InspecteurName" == 112 ]]; then Achitecte=$(echo -e "De Hennezel"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
elif [[ "$InspecteurName" == 115 ]]; then Achitecte=$(echo -e "Du Souich"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
elif [[ "$InspecteurName" == 117 ]]; then Achitecte=$(echo -e "De Fourcy"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
elif [[ "$InspecteurName" == 118 ]]; then Achitecte=$(echo -e "Lantillon"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
elif [[ "$InspecteurName" == 119 ]]; then Achitecte=$(echo -e "Jacquot"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
elif [[ "$InspecteurName" == 123 ]]; then Achitecte=$(echo -e "Tournaire"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
elif [[ "$InspecteurName" == 129 ]]; then Achitecte=$(echo -e "Roger"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
elif [[ "$InspecteurName" == 120 ]]; then Achitecte=$(echo -e "Descottes"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
elif [[ "$InspecteurName" == 126 ]]; then Achitecte=$(echo -e "Gentil"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
elif [[ "$InspecteurName" == 131 ]]; then Achitecte=$(echo -e "O. KELLER"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
elif [[ "$InspecteurName" == 134 ]]; then Achitecte=$(echo -e "Wickersheimer"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
elif [[ "$InspecteurName" == 135 ]]; then Achitecte=$(echo -e "Weiss"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
else
Achitecte=$(echo -e "NR"); echo -e "${white}---> Inspecteurs / Architectes : ${orange}$Achitecte";
fi
InscriptionYear=$(echo -e "$substringfields" | awk -F'field_annee' '{print $2}' | awk -F'tid'\'' => '\''' '{print $2}'| awk -F''\''' '{print $1}' |awk 'NF')
# Année (to be updated)
if [[ "$InscriptionYear" == 140 ]]; then Annee=$(echo -e "1624"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 392 ]]; then Annee=$(echo -e "1709"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 171 ]]; then Annee=$(echo -e "1777"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 156 ]]; then Annee=$(echo -e "1778"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 141 ]]; then Annee=$(echo -e "1780"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 173 ]]; then Annee=$(echo -e "1781"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 293 ]]; then Annee=$(echo -e "1784"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 177 ]]; then Annee=$(echo -e "1785"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 89 ]]; then Annee=$(echo -e "1786"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 91 ]]; then Annee=$(echo -e "1791"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 144 ]]; then Annee=$(echo -e "1792"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 383 ]]; then Annee=$(echo -e "1797"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 149 ]]; then Annee=$(echo -e "1802"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 151 ]]; then Annee=$(echo -e "1804"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 388 ]]; then Annee=$(echo -e "1805"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 137 ]]; then Annee=$(echo -e "1806"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 104 ]]; then Annee=$(echo -e "1808"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 150 ]]; then Annee=$(echo -e "1809"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 387 ]]; then Annee=$(echo -e "1810"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 148 ]]; then Annee=$(echo -e "1811"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 94 ]]; then Annee=$(echo -e "1817"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 389 ]]; then Annee=$(echo -e "1819"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 172 ]]; then Annee=$(echo -e "1822"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 385 ]]; then Annee=$(echo -e "1825"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 382 ]]; then Annee=$(echo -e "1835"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 106 ]]; then Annee=$(echo -e "1841"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 375 ]]; then Annee=$(echo -e "1842"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 376 ]]; then Annee=$(echo -e "1843"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 109 ]]; then Annee=$(echo -e "1844"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 291 ]]; then Annee=$(echo -e "1845"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 194 ]]; then Annee=$(echo -e "1846"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 290 ]]; then Annee=$(echo -e "1847"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 371 ]]; then Annee=$(echo -e "1848"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 372 ]]; then Annee=$(echo -e "1849"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 166 ]]; then Annee=$(echo -e "1850"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 165 ]]; then Annee=$(echo -e "1851"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 175 ]]; then Annee=$(echo -e "1852"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 374 ]]; then Annee=$(echo -e "1852"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 111 ]]; then Annee=$(echo -e "1853"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 195 ]]; then Annee=$(echo -e "1854"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 187 ]]; then Annee=$(echo -e "1855"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 101 ]]; then Annee=$(echo -e "1856"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 196 ]]; then Annee=$(echo -e "1857"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 198 ]]; then Annee=$(echo -e "1858"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 201 ]]; then Annee=$(echo -e "1859"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 199 ]]; then Annee=$(echo -e "186 ?"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 163 ]]; then Annee=$(echo -e "1861"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 200 ]]; then Annee=$(echo -e "1862"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 114 ]]; then Annee=$(echo -e "1863"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 161 ]]; then Annee=$(echo -e "1864"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 116 ]]; then Annee=$(echo -e "1865"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 349 ]]; then Annee=$(echo -e "1866"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 197 ]]; then Annee=$(echo -e "1867"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 186 ]]; then Annee=$(echo -e "1868"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 185 ]]; then Annee=$(echo -e "1869"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 191 ]]; then Annee=$(echo -e "187"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 370 ]]; then Annee=$(echo -e "187?"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 182 ]]; then Annee=$(echo -e "1870"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 190 ]]; then Annee=$(echo -e "1871"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 189 ]]; then Annee=$(echo -e "1872"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 188 ]]; then Annee=$(echo -e "1873"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 121 ]]; then Annee=$(echo -e "1875"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 124 ]]; then Annee=$(echo -e "1876"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 174 ]]; then Annee=$(echo -e "1877"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 127 ]]; then Annee=$(echo -e "1878"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 152 ]]; then Annee=$(echo -e "1882"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 130 ]]; then Annee=$(echo -e "1883"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 192 ]]; then Annee=$(echo -e "1884"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 168 ]]; then Annee=$(echo -e "1885"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 170 ]]; then Annee=$(echo -e "1889"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 143 ]]; then Annee=$(echo -e "1890"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 283 ]]; then Annee=$(echo -e "1891"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 284 ]]; then Annee=$(echo -e "1892"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 167 ]]; then Annee=$(echo -e "1893"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 132 ]]; then Annee=$(echo -e "1895"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 169 ]]; then Annee=$(echo -e "1896"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 285 ]]; then Annee=$(echo -e "1897"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 384 ]]; then Annee=$(echo -e "1901"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 390 ]]; then Annee=$(echo -e "1908"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 391 ]]; then Annee=$(echo -e "1909"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 386 ]]; then Annee=$(echo -e "1939"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 145 ]]; then Annee=$(echo -e "1993"); echo -e "${white}---> Année : ${orange}$Annee";
elif [[ "$InscriptionYear" == 278 ]]; then Annee=$(echo -e "2011"); echo -e "${white}---> Année : ${orange}$Annee";
else
InscriptionYear=$(echo -e "NR"); echo -e "${white}---> Année : ${orange}$InscriptionYear";
fi
## Type D'inscriptions
if [[ "$TypeDInscription" == 183 ]]; then TypeDInscriptionABC=$(echo -e "Consolidation"); echo -e "${white}---> Type D'inscriptions : ${orange}$TypeDInscriptionABC";
elif [[ "$TypeDInscription" == 322 ]]; then TypeDInscriptionABC=$(echo -e "Metropolitain"); echo -e "${white}---> Type D'inscriptions : ${orange}$TypeDInscriptionABC";
elif [[ "$TypeDInscription" == 364 ]]; then TypeDInscriptionABC=$(echo -e "Dessin"); echo -e "${white}---> Type D'inscriptions : ${orange}$TypeDInscriptionABC";
elif [[ "$TypeDInscription" == 366 ]]; then TypeDInscriptionABC=$(echo -e "Épure"); echo -e "${white}---> Type D'inscriptions : ${orange}$TypeDInscriptionABC";
elif [[ "$TypeDInscription" == 327 ]]; then TypeDInscriptionABC=$(echo -e "Fusain"); echo -e "${white}---> Type D'inscriptions : ${orange}$TypeDInscriptionABC";
elif [[ "$TypeDInscription" == 180 ]]; then TypeDInscriptionABC=$(echo -e "Indication altimétrique"); echo -e "${white}---> Type D'inscriptions : ${orange}$TypeDInscriptionABC";
elif [[ "$TypeDInscription" == 365 ]]; then TypeDInscriptionABC=$(echo -e "Indication topographique"); echo -e "${white}---> Type D'inscriptions : ${orange}$TypeDInscriptionABC";
elif [[ "$TypeDInscription" == 275 ]]; then TypeDInscriptionABC=$(echo -e "Nom de lieu"); echo -e "${white}---> Type D'inscriptions : ${orange}$TypeDInscriptionABC";
elif [[ "$TypeDInscription" == 326 ]]; then TypeDInscriptionABC=$(echo -e "Sanguine"); echo -e "${white}---> Type D'inscriptions : ${orange}$TypeDInscriptionABC";
elif [[ "$TypeDInscription" == 330 ]]; then TypeDInscriptionABC=$(echo -e "Voie"); echo -e "${white}---> Type D'inscriptions : ${orange}$TypeDInscriptionABC";
else
TypeDInscription=$(echo -e "NR"); echo -e "${white}---> Type D'inscriptions : ${orange}$TypeDInscription";
fi
echo "${purple} TypeDInscriptionABC ${red}$TypeDInscriptionABC${white}"
echo -e " <Placemark>
<name>"$NodeTitle"</name>
<TimeStamp><when>"$LastRevisionTimestamp"</when></TimeStamp>
<styleUrl>#$StyleKml</styleUrl>
<ExtendedData>
<SchemaData schemaUrl=\"#schemPOI\">
<SimpleData name=\"Type de P.O.I\">"$TypeDePOIsABC"</SimpleData>
<SimpleData name=\"Type d’inscription\">"$TypeDInscriptionABC"</SimpleData>
<SimpleData name=\"Inspecteur / Architecte\">"$Achitecte"</SimpleData>
<SimpleData name=\"Description\">"$body"</SimpleData>
<SimpleData name=\"NodeID\">"$Annee"</SimpleData>
<SimpleData name=\"Commentaire\"></SimpleData>
<SimpleData name=\"Date de Création\"><when>"$CreatedDate"</when></SimpleData>
<SimpleData name=\"NodeID\">"$NodeID"</SimpleData>
<SimpleData name=\"VID\">"$NodeVID"</SimpleData>
<SimpleData name=\"Vuuid\">"$Vuuid"</SimpleData>
</SchemaData>
</ExtendedData>
<Point>
<coordinates>$coordinates4326</coordinates>
</Point>
</Placemark>" >> POITemp.kml
done < NodePoi.csv
echo -e '<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2">
<Document>
<Schema id="schemPOI" name="schema POI">
<SimpleField name="Description" type="string"/>
<SimpleField name="pdfmaps_photos" type="string">
<displayName>Photos</displayName>
</SimpleField>
<SimpleField name="Année" type="string"/>
<SimpleField name="Inspecteur / Architecte" type="string"/>
<SimpleField name="Type De P.O.I" type="string"/>
<SimpleField name="Type D’inscription" type="string"/>
<SimpleField name="Voie, lieu dit" type="string"/>
</Schema>
<ExtendedData xmlns:avenza="http://www.avenza.com">
<avenza:picklist schemaUrl="schemPOI" avenza:field="Type de P.O.I">
<avenza:picklistvalue><![CDATA[Abri]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Lieu dit]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Inscription 1er niveau]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Inscription 3e niveau]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Inscription 2e niveau]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Curiosité]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Puits à eau]]></avenza:picklistvalue>
</avenza:picklist>
<avenza:picklist schemaUrl="schemPOI" avenza:field="Inspecteur / Architecte">
<avenza:picklistvalue><![CDATA[François Mansart]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Charles-Axel Guillaumot]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Demoustier]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Antoine Dupont]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Bralle]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Blavier]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Du Souich]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Descottes]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Roger]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Gentil]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Wickersheimer]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Weiss]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Lantillon]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Commission]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Juncker]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Jacquot]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[De Hennezel]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Duchemin]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Héricart de Thury]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[De Fourcy]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[O. KELLER]]></avenza:picklistvalue>
</avenza:picklist>
<avenza:picklist schemaUrl="schemPOI" avenza:field="Type D’inscription">
<avenza:picklistvalue><![CDATA[Consolidation]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Metropolitain]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Dessin]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Épure]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Fusain]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Indication altimétrique]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Indication topographique]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Sanguine]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Voie]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Pienture]]></avenza:picklistvalue>
<avenza:picklistvalue><![CDATA[Sculpture]]></avenza:picklistvalue>
</avenza:picklist>
</ExtendedData>
<Folder>
<styleUrl>#style0</styleUrl>
<name>P.O.I</name>
<ExtendedData>
<SchemaData schemaUrl="#schemPOI"/>
</ExtendedData>
' > POI.kml
cat POITemp.kml| awk 'NF' | awk '!/P.O.I"><\/SimpleData>/'| awk '!/inscription"><\/SimpleData>/'| awk '!/Architecte"><\/SimpleData>/'| awk '!/Commentaire"><\/SimpleData>/'| awk '!/Création"><\/SimpleData>/'| awk '!/NodeID"><\/SimpleData>/'| awk '!/VID"><\/SimpleData>/'| awk '!/Vuuid"><\/SimpleData>/'| awk '!/Description"><\/SimpleData>/'| awk '!/>NR<\/SimpleData>/' >> POI.kml
rm POITemp.kml
echo -e ' </Folder>
<Style id="ISc3">
<IconStyle>
<Icon>
<scale>10</scale>
<href>https://raw.githubusercontent.com/babinet/InOutNOutIn/main/Img/ISc3.png</href>
</Icon>
</IconStyle>
</Style>
<Style id="ISc2">
<IconStyle>
<Icon>
<scale>10</scale>
<href>https://raw.githubusercontent.com/babinet/InOutNOutIn/main/Img/ISc2.png</href>
</Icon>
</IconStyle>
</Style>
<Style id="ISc1">
<IconStyle>
<Icon>
<scale>10</scale>
<href>https://raw.githubusercontent.com/babinet/InOutNOutIn/main/Img/ISc1.png</href>
</Icon>
</IconStyle>
</Style>
<Style id="CRs">
<IconStyle>
<Icon>
<scale>10</scale>
<href>https://raw.githubusercontent.com/babinet/InOutNOutIn/main/Img/CRs.png</href>
</Icon>
</IconStyle>
</Style>
<Style id="A">
<IconStyle>
<Icon>
<scale>10</scale>
<href>https://raw.githubusercontent.com/babinet/InOutNOutIn/main/Img/A.png</href>
</Icon>
</IconStyle>
</Style>
<Style id="PE">
<IconStyle>
<Icon>
<scale>10</scale>
<href>https://raw.githubusercontent.com/babinet/InOutNOutIn/main/Img/PE.png</href>
</Icon>
</IconStyle>
</Style>
<Style id="LD">
<IconStyle>
<Icon>
<scale>10</scale>
<href>https://raw.githubusercontent.com/babinet/InOutNOutIn/main/Img/LD.png</href>
</Icon>
</IconStyle>
</Style>
</Document>
</kml>' >> POI.kml
gpsbabel -w -i kml -f POI.kml -o gpx -F POI.gpx
ogr2ogr -f GeoJSON POI.json POI.kml
mv POI.gpx "$FileDate"_P.O.I.gpx
mv POI.kml "$FileDate"_P.O.I.kml
mv POI.json "$FileDate"_P.O.I.json
zip P.O.I.zip *_P.O.I.*
cd -