-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
4486 lines (4402 loc) · 679 KB
/
index.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
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
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
<meta charset="utf-8">
<meta name="generator" content="quarto-1.1.251">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<meta name="author" content="Ronan Ysebaert">
<meta name="dcterms.date" content="2023-01-20">
<title>Travel time calculation with R and data visualization with Observable</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
width: 0.8em;
margin: 0 0.8em 0.2em -1.6em;
vertical-align: middle;
}
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { color: #008000; } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { color: #008000; font-weight: bold; } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
div.csl-bib-body { }
div.csl-entry {
clear: both;
}
.hanging div.csl-entry {
margin-left:2em;
text-indent:-2em;
}
div.csl-left-margin {
min-width:2em;
float:left;
}
div.csl-right-inline {
margin-left:2em;
padding-left:1em;
}
div.csl-indent {
margin-left: 2em;
}
</style>
<script src="index_files/libs/clipboard/clipboard.min.js"></script>
<script src="index_files/libs/quarto-html/quarto.js"></script>
<script src="index_files/libs/quarto-html/popper.min.js"></script>
<script src="index_files/libs/quarto-html/tippy.umd.min.js"></script>
<script src="index_files/libs/quarto-html/anchor.min.js"></script>
<link href="index_files/libs/quarto-html/tippy.css" rel="stylesheet">
<link href="index_files/libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<script src="index_files/libs/bootstrap/bootstrap.min.js"></script>
<link href="index_files/libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="index_files/libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
<script type="module" src="index_files/libs/quarto-ojs/quarto-ojs-runtime.js"></script>
<link href="index_files/libs/quarto-ojs/quarto-ojs.css" rel="stylesheet">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div id="quarto-content" class="page-columns page-rows-contents page-layout-article">
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
<nav id="TOC" role="doc-toc" class="toc-active">
<h2 id="toc-title">Table of contents</h2>
<ul class="collapse">
<li><a href="#data-processing-with-r" id="toc-data-processing-with-r" class="nav-link active" data-scroll-target="#data-processing-with-r">Data processing with R</a>
<ul class="collapse">
<li><a href="#data-sources" id="toc-data-sources" class="nav-link" data-scroll-target="#data-sources">Data sources</a></li>
<li><a href="#map-layout" id="toc-map-layout" class="nav-link" data-scroll-target="#map-layout">Map layout</a></li>
<li><a href="#feed-iris-with-socio-economic-data-insee" id="toc-feed-iris-with-socio-economic-data-insee" class="nav-link" data-scroll-target="#feed-iris-with-socio-economic-data-insee">Feed IRIS with socio-economic data (INSEE)</a></li>
<li><a href="#prepare-iris-for-travel-time-calculation" id="toc-prepare-iris-for-travel-time-calculation" class="nav-link" data-scroll-target="#prepare-iris-for-travel-time-calculation">Prepare IRIS for travel-time calculation</a></li>
<li><a href="#import-osm-points-of-interest" id="toc-import-osm-points-of-interest" class="nav-link" data-scroll-target="#import-osm-points-of-interest">Import OSM points of interest</a></li>
<li><a href="#travel-time-calculations-with-osrm" id="toc-travel-time-calculations-with-osrm" class="nav-link" data-scroll-target="#travel-time-calculations-with-osrm">Travel-time calculations with OSRM</a></li>
<li><a href="#travel-time-isochrones" id="toc-travel-time-isochrones" class="nav-link" data-scroll-target="#travel-time-isochrones">Travel time isochrones</a></li>
<li><a href="#osrm-climbing-trip" id="toc-osrm-climbing-trip" class="nav-link" data-scroll-target="#osrm-climbing-trip">OSRM climbing trip</a></li>
<li><a href="#simplify-geometries" id="toc-simplify-geometries" class="nav-link" data-scroll-target="#simplify-geometries">Simplify geometries</a></li>
<li><a href="#export-results" id="toc-export-results" class="nav-link" data-scroll-target="#export-results">Export results</a></li>
<li><a href="#session-info-r" id="toc-session-info-r" class="nav-link" data-scroll-target="#session-info-r">Session info (R)</a></li>
</ul></li>
<li><a href="#data-visualization-with-observable-javascript-ojs" id="toc-data-visualization-with-observable-javascript-ojs" class="nav-link" data-scroll-target="#data-visualization-with-observable-javascript-ojs">Data visualization with Observable JavaScript (ojs)</a>
<ul class="collapse">
<li><a href="#import-consolidated-data" id="toc-import-consolidated-data" class="nav-link" data-scroll-target="#import-consolidated-data">Import consolidated data</a></li>
<li><a href="#layers-attributes-and-metadata" id="toc-layers-attributes-and-metadata" class="nav-link" data-scroll-target="#layers-attributes-and-metadata">Layers attributes and metadata</a></li>
<li><a href="#walls-characteristics" id="toc-walls-characteristics" class="nav-link" data-scroll-target="#walls-characteristics">Wall’s characteristics</a></li>
<li><a href="#nearest-wall" id="toc-nearest-wall" class="nav-link" data-scroll-target="#nearest-wall">Nearest wall</a></li>
<li><a href="#time-to-climb-iris" id="toc-time-to-climb-iris" class="nav-link" data-scroll-target="#time-to-climb-iris">Time to climb (IRIS)</a></li>
<li><a href="#time-to-reach-climbing-areas-isochrones" id="toc-time-to-reach-climbing-areas-isochrones" class="nav-link" data-scroll-target="#time-to-reach-climbing-areas-isochrones">Time to reach climbing areas (isochrones)</a></li>
<li><a href="#climbing-in-15-minutes" id="toc-climbing-in-15-minutes" class="nav-link" data-scroll-target="#climbing-in-15-minutes">Climbing in 15 minutes?</a></li>
<li><a href="#climbing-biking-tour" id="toc-climbing-biking-tour" class="nav-link" data-scroll-target="#climbing-biking-tour">Climbing / biking tour !</a></li>
<li><a href="#demographic-neighbourhood" id="toc-demographic-neighbourhood" class="nav-link" data-scroll-target="#demographic-neighbourhood">Demographic neighbourhood</a></li>
<li><a href="#income-neighbourhood" id="toc-income-neighbourhood" class="nav-link" data-scroll-target="#income-neighbourhood">Income neighbourhood</a></li>
</ul></li>
<li><a href="#concluding-methodological-remarks" id="toc-concluding-methodological-remarks" class="nav-link" data-scroll-target="#concluding-methodological-remarks">Concluding methodological remarks</a>
<ul class="collapse">
<li><a href="#extend-the-analysis" id="toc-extend-the-analysis" class="nav-link" data-scroll-target="#extend-the-analysis">Extend the analysis</a></li>
<li><a href="#usage-precautions" id="toc-usage-precautions" class="nav-link" data-scroll-target="#usage-precautions">Usage precautions</a></li>
</ul></li>
<li><a href="#references" id="toc-references" class="nav-link" data-scroll-target="#references">References</a></li>
</ul>
</nav>
</div>
<main class="content" id="quarto-document-content">
<header id="title-block-header" class="quarto-title-block default">
<div class="quarto-title">
<div class="quarto-title-block"><div><h1 class="title">Travel time calculation with R and data visualization with Observable</h1><button type="button" class="btn code-tools-button dropdown-toggle" id="quarto-code-tools-menu" data-bs-toggle="dropdown" aria-expanded="false"><i class="bi"></i> Code</button><ul class="dropdown-menu dropdown-menu-end" aria-labelelledby="quarto-code-tools-menu"><li><a id="quarto-show-all-code" class="dropdown-item" href="javascript:void(0)" role="button">Show All Code</a></li><li><a id="quarto-hide-all-code" class="dropdown-item" href="javascript:void(0)" role="button">Hide All Code</a></li><li><hr class="dropdown-divider"></li><li><a id="quarto-view-source" class="dropdown-item" href="javascript:void(0)" role="button">View Source</a></li></ul></div></div>
<p class="subtitle lead">Application to artifical climbing walls in Paris and its neighbourhood</p>
</div>
<div class="quarto-title-meta-author">
<div class="quarto-title-meta-heading">Author</div>
<div class="quarto-title-meta-heading">Affiliation</div>
<div class="quarto-title-meta-contents">
<a href="https://rysebaert.github.io/climbing_paris/">Ronan Ysebaert</a>
</div>
<div class="quarto-title-meta-contents">
<p class="affiliation">
<a href="https://riate.cnrs.fr/">
UAR RIATE, Université Paris Cité, CNRS
</a>
</p>
</div>
</div>
<div class="quarto-title-meta">
<div>
<div class="quarto-title-meta-heading">Published</div>
<div class="quarto-title-meta-contents">
<p class="date">January 20, 2023</p>
</div>
</div>
</div>
</header>
<p>The aim of this notebook consists in showing how to build, visualize and reproduce accessibility indicators by combining points of interest (POI) coming from the OpenStreetMap database, socio-economic indicators included in small territorial division (IRIS) coming from institutional data source (INSEE) and routing engines (OSRM).</p>
<p>The graphical outputs displayed in this notebook are further developed in an <a href="https://observablehq.com/collection/@rysebaert/climbing_paris" title="Go to Observable Notebook">Observable collection</a>. To introduce the reader to the issues raised by indoor sport-climbing in Paris, have a look to <a href="https://observablehq.com/d/d2be39c4dd55a32d?collection=@rysebaert/climbing_paris" title="Go to Observable Notebook">this notebook</a>.</p>
<p>This Quarto document combines 2 programming languages : R for data processing, and ObservableJS for data visualizations.</p>
<section id="data-processing-with-r" class="level1">
<h1>Data processing with R</h1>
<p>The entire R script can be found <a href="https://github.com/rysebaert/climbing_paris/blob/main/script.R">here</a>. Geojson files resulting from the data processing are available in the <a href="https://github.com/rysebaert/climbing_paris/tree/main/data-conso">data-conso</a> folder of the github repository of the project. These files are directly imported in Observable notebooks for data visualization.</p>
<section id="data-sources" class="level2">
<h2 class="anchored" data-anchor-id="data-sources">Data sources</h2>
<p>Three data sources, coming from three data providers, will be used:</p>
<ul>
<li><p><strong>IGN</strong> : <a href="https://geoservices.ign.fr/contoursiris" title="Access to input geometries (France)">The Contour…IRIS® édition 2020</a>, which corresponds to the lowest territorial division in France (below the communes level).</p></li>
<li><p><strong>INSEE</strong> : for socio-economic indicators (IRIS <a href="https://www.insee.fr/fr/statistiques/6049648" title="Go to input data">Median income</a> and <a href="https://www.insee.fr/fr/statistiques/5650720?sommaire=4658626" title="Go to input data">population</a> in 2019).</p></li>
<li><p><strong>OpenStreetMap</strong> : download of Point Of Interest (POI) and travel time calculation by bike between IRIS centroids and POI, using the <a href="http://project-osrm.org/" title="Access to OSRM Website">OSRM routing engine</a>.</p></li>
</ul>
<p>Input data is not provided in the <a href="https://github.com/rysebaert/climbing_paris">GitHub repository</a> (too large files), but can easily be downloaded and used (no constraints of use).</p>
</section>
<section id="map-layout" class="level2">
<h2 class="anchored" data-anchor-id="map-layout">Map layout</h2>
<p>A bounding box of 5 km around Paris, without <em>Bois de Boulogne</em> and <em>Bois de Vincennes</em> for a better centering of the map layout around Paris is created.</p>
<p>A second bounding box (10 km around Paris) is created to catch OpenStreetMap POI and IRIS in the neighbourhood of this study area and avoid “border effects” for the upcoming travel-time indicators calculations.</p>
<div class="cell">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="co"># 1. Map layout preparation at IRIS scale (source IGN)----</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(sf)</span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a>iris <span class="ot"><-</span> <span class="fu">st_read</span>(<span class="st">"data-raw/CONTOURS-IRIS.shp"</span>, <span class="at">quiet =</span> <span class="cn">TRUE</span>)</span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="co"># Extract Paris and delete </span></span>
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a><span class="co"># Bois-de-Vincennes / Boulogne Iris for map template</span></span>
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a>iris<span class="sc">$</span>dep <span class="ot"><-</span> <span class="fu">substr</span>(iris<span class="sc">$</span>INSEE_COM, <span class="dv">1</span>, <span class="dv">2</span>)</span>
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a>paris <span class="ot"><-</span> iris[iris<span class="sc">$</span>dep <span class="sc">==</span> <span class="st">"75"</span>,]</span>
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a>paris <span class="ot"><-</span> paris[<span class="sc">!</span>paris<span class="sc">$</span>NOM_IRIS <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">"Bois de Vincennes 1"</span>,</span>
<span id="cb1-10"><a href="#cb1-10" aria-hidden="true" tabindex="-1"></a> <span class="st">"Bois de Vincennes 2"</span>,</span>
<span id="cb1-11"><a href="#cb1-11" aria-hidden="true" tabindex="-1"></a> <span class="st">"Bois de Boulogne 1"</span>,</span>
<span id="cb1-12"><a href="#cb1-12" aria-hidden="true" tabindex="-1"></a> <span class="st">"Bois de Boulogne 2"</span>,</span>
<span id="cb1-13"><a href="#cb1-13" aria-hidden="true" tabindex="-1"></a> <span class="st">"Bois de Boulogne 3"</span>),]</span>
<span id="cb1-14"><a href="#cb1-14" aria-hidden="true" tabindex="-1"></a>paris <span class="ot"><-</span> <span class="fu">st_union</span>(paris)</span>
<span id="cb1-15"><a href="#cb1-15" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-16"><a href="#cb1-16" aria-hidden="true" tabindex="-1"></a><span class="co"># 5 km around Paris map layout</span></span>
<span id="cb1-17"><a href="#cb1-17" aria-hidden="true" tabindex="-1"></a>paris5k <span class="ot"><-</span> <span class="fu">st_buffer</span>(paris, <span class="dv">5000</span>)</span>
<span id="cb1-18"><a href="#cb1-18" aria-hidden="true" tabindex="-1"></a>paris5k <span class="ot"><-</span> <span class="fu">st_as_sfc</span>(<span class="fu">st_bbox</span>(paris5k, <span class="at">crs =</span> <span class="dv">2154</span>))</span>
<span id="cb1-19"><a href="#cb1-19" aria-hidden="true" tabindex="-1"></a>paris <span class="ot"><-</span> paris5k</span>
<span id="cb1-20"><a href="#cb1-20" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-21"><a href="#cb1-21" aria-hidden="true" tabindex="-1"></a><span class="co"># 10 km around Paris (get OSM data) in long/lat</span></span>
<span id="cb1-22"><a href="#cb1-22" aria-hidden="true" tabindex="-1"></a>paris10k <span class="ot"><-</span> <span class="fu">st_buffer</span>(paris, <span class="dv">10000</span>)</span>
<span id="cb1-23"><a href="#cb1-23" aria-hidden="true" tabindex="-1"></a>paris10k <span class="ot"><-</span> <span class="fu">st_as_sfc</span>(<span class="fu">st_bbox</span>(paris10k, <span class="at">crs =</span> <span class="dv">2154</span>))</span>
<span id="cb1-24"><a href="#cb1-24" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-25"><a href="#cb1-25" aria-hidden="true" tabindex="-1"></a><span class="co"># Intersection with IRIS</span></span>
<span id="cb1-26"><a href="#cb1-26" aria-hidden="true" tabindex="-1"></a>iris10k <span class="ot"><-</span> <span class="fu">st_intersection</span>(iris, paris10k)</span>
<span id="cb1-27"><a href="#cb1-27" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-28"><a href="#cb1-28" aria-hidden="true" tabindex="-1"></a><span class="co"># Bounding box for osm extract</span></span>
<span id="cb1-29"><a href="#cb1-29" aria-hidden="true" tabindex="-1"></a>paris10k <span class="ot"><-</span> <span class="fu">st_transform</span>(paris10k, <span class="dv">4326</span>)</span>
<span id="cb1-30"><a href="#cb1-30" aria-hidden="true" tabindex="-1"></a>paris10k <span class="ot"><-</span> <span class="fu">st_bbox</span>(paris10k) </span>
<span id="cb1-31"><a href="#cb1-31" aria-hidden="true" tabindex="-1"></a>paris10k <span class="ot"><-</span> <span class="fu">as.vector</span>(paris10k)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
<section id="feed-iris-with-socio-economic-data-insee" class="level2">
<h2 class="anchored" data-anchor-id="feed-iris-with-socio-economic-data-insee">Feed IRIS with socio-economic data (INSEE)</h2>
<p>Data is enriched by socio-economic data (disposable median income 2019 and total population 2018) for further analysis. We keep only “Habitation” IRIS (dedicated to dwellings) for origins-destinations calculations.</p>
<div class="cell">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="co"># 2. Feed IRIS layer by socio-economic data (INSEE) ----</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(readxl)</span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a><span class="co"># Population 2018 (IRIS)</span></span>
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a>df <span class="ot"><-</span> <span class="fu">read_xlsx</span>(<span class="st">"data-raw/base-ic-evol-struct-pop-2018.xlsx"</span>, <span class="at">skip =</span> <span class="dv">5</span>, <span class="at">sheet =</span> <span class="st">"IRIS"</span>)</span>
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a>iris10k <span class="ot"><-</span> <span class="fu">merge</span>(iris10k[,<span class="fu">c</span>(<span class="st">"CODE_IRIS"</span>, <span class="st">"NOM_IRIS"</span>, <span class="st">"TYP_IRIS"</span>, <span class="st">"NOM_COM"</span>)], </span>
<span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a> df[,<span class="fu">c</span>(<span class="st">"IRIS"</span>,<span class="st">"P18_POP"</span>)],</span>
<span id="cb2-8"><a href="#cb2-8" aria-hidden="true" tabindex="-1"></a> <span class="at">by.x =</span> <span class="st">"CODE_IRIS"</span>, <span class="at">by.y =</span> <span class="st">"IRIS"</span>, <span class="at">all.x =</span> <span class="cn">TRUE</span>)</span>
<span id="cb2-9"><a href="#cb2-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-10"><a href="#cb2-10" aria-hidden="true" tabindex="-1"></a><span class="co"># Median Income (2018)</span></span>
<span id="cb2-11"><a href="#cb2-11" aria-hidden="true" tabindex="-1"></a>df <span class="ot"><-</span> <span class="fu">read_xlsx</span>(<span class="st">"data-raw/BASE_TD_FILO_DISP_IRIS_2019.xlsx"</span>, <span class="at">skip =</span> <span class="dv">5</span>, <span class="at">sheet =</span> <span class="st">"IRIS_DISP"</span>)</span>
<span id="cb2-12"><a href="#cb2-12" aria-hidden="true" tabindex="-1"></a>iris10k <span class="ot"><-</span> <span class="fu">merge</span>(iris10k, df[,<span class="fu">c</span>(<span class="st">"IRIS"</span>,<span class="st">"DISP_MED19"</span>)],</span>
<span id="cb2-13"><a href="#cb2-13" aria-hidden="true" tabindex="-1"></a> <span class="at">by.x =</span> <span class="st">"CODE_IRIS"</span>, <span class="at">by.y =</span> <span class="st">"IRIS"</span>, <span class="at">all.x =</span> <span class="cn">TRUE</span>)</span>
<span id="cb2-14"><a href="#cb2-14" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-15"><a href="#cb2-15" aria-hidden="true" tabindex="-1"></a><span class="co"># Intersection with study area</span></span>
<span id="cb2-16"><a href="#cb2-16" aria-hidden="true" tabindex="-1"></a>iris <span class="ot"><-</span> <span class="fu">st_intersection</span>(iris10k, paris5k)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
<section id="prepare-iris-for-travel-time-calculation" class="level2">
<h2 class="anchored" data-anchor-id="prepare-iris-for-travel-time-calculation">Prepare IRIS for travel-time calculation</h2>
<p>IRIS centroids are extracted. These points will be used for the origins of travel-time calculations. Only IRIS including dwellings are kept (TYP_IRIS == “H”).</p>
<p>These <code>sf</code> objects are transformed in latitude/longitude (origin-destination calculations requirements and for final export in geojson format).</p>
<div class="cell">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Keep only habitation IRIS for origins calculation</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a>ori <span class="ot"><-</span> iris10k[iris10k<span class="sc">$</span>TYP_IRIS <span class="sc">==</span> <span class="st">"H"</span>,]</span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a>ori <span class="ot"><-</span> <span class="fu">st_centroid</span>(ori)</span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a><span class="co"># Transform in long/lat</span></span>
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a>ori <span class="ot"><-</span> <span class="fu">st_transform</span>(ori, <span class="at">crs =</span> <span class="dv">4326</span>)</span>
<span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a>iris <span class="ot"><-</span> <span class="fu">st_transform</span>(iris, <span class="at">crs =</span> <span class="dv">4326</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
<section id="import-osm-points-of-interest" class="level2">
<h2 class="anchored" data-anchor-id="import-osm-points-of-interest">Import OSM points of interest</h2>
<p>Points of interest (climbing areas) are extracted from OpenStreetMap thanks to the <code>osmdata</code> R package (<span class="citation" data-cites="osmdata">Mark Padgham (<a href="#ref-osmdata" role="doc-biblioref">2022</a>)</span>).</p>
<p>To access to these OSM features, the OSM key-value pair (or OSM tag) must be set. For climbing areas, the most appropriate is <code>sport=climbing</code>. In the <a href="https://wiki.openstreetmap.org/wiki/Tag:sport%3Dclimbing" title="Tag:sport=climbing in OSM wiki">OpenStreetMap wiki</a>, it is mentioned that “<em>sport=climbing should be preferably applied to noded for artificial climbing walls”.</em> Thus, we only consider points responding to the query.</p>
<p>The geographical coverage of the query covers a bounding box of 10 km around Paris (<code>paris10k</code>`).</p>
<div class="cell">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="co"># 3. Extract OSM objects (climbing and map layout)----</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(osmdata)</span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a><span class="co"># define a bounding box</span></span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a>q0 <span class="ot"><-</span> <span class="fu">opq</span>(<span class="at">bbox =</span> paris10k) </span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a><span class="co"># extract climbing areas</span></span>
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a>q <span class="ot"><-</span> <span class="fu">add_osm_feature</span>(<span class="at">opq =</span> q0, <span class="at">key =</span> <span class="st">'sport'</span>, <span class="at">value =</span> <span class="st">"climbing"</span>)</span>
<span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a>res <span class="ot"><-</span> <span class="fu">osmdata_sf</span>(q)</span>
<span id="cb4-10"><a href="#cb4-10" aria-hidden="true" tabindex="-1"></a>dest <span class="ot"><-</span> res<span class="sc">$</span>osm_points</span>
<span id="cb4-11"><a href="#cb4-11" aria-hidden="true" tabindex="-1"></a>dest[,<span class="st">"name"</span>] <span class="ot"><-</span> <span class="fu">iconv</span>(dest<span class="sc">$</span>name, <span class="at">from =</span> <span class="st">"UTF-8"</span>, <span class="at">to =</span> <span class="st">"UTF-8"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
<p>The OSM attributes are transformed afterwards for further analytical purposes in order to differentiate private and associative structures, and bouldering areas and climbing walls (to different climbing practices).</p>
<p>I argue that the accuracy and completeness of the data is quite good : I have edited missing points on OpenStreetMap database with my personal knowledge and upstream investigation :-)</p>
<p>For the presentation of the artificial climbing landscape in Paris and the difference between private - FSGT and FFME structures, have a look to <a href="https://observablehq.com/@rysebaert/forewords">this notebook</a>.</p>
<div class="cell">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Cleaning</span></span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a>private <span class="ot"><-</span> dest[<span class="sc">!</span><span class="fu">is.na</span>(dest<span class="sc">$</span>brand),] <span class="co"># Manage private and associative areas</span></span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a>asso <span class="ot"><-</span> dest[<span class="sc">!</span><span class="fu">is.na</span>(dest<span class="sc">$</span>federation),]</span>
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a>asso<span class="sc">$</span>type <span class="ot"><-</span> <span class="st">"Associative structure"</span></span>
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a>private<span class="sc">$</span>type <span class="ot"><-</span> <span class="st">"Speculative structure"</span></span>
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a>dest <span class="ot"><-</span> <span class="fu">rbind</span>(asso, private)</span>
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a>dest<span class="sc">$</span>federation[<span class="fu">is.na</span>(dest<span class="sc">$</span>federation)] <span class="ot"><-</span> <span class="st">"Private"</span></span>
<span id="cb5-8"><a href="#cb5-8" aria-hidden="true" tabindex="-1"></a><span class="co"># Find walls and boulders</span></span>
<span id="cb5-9"><a href="#cb5-9" aria-hidden="true" tabindex="-1"></a>dest[<span class="fu">c</span>(<span class="st">"climbing.toprope"</span>, <span class="st">"climbing.boulder"</span>)][<span class="fu">is.na</span>(dest[<span class="fu">c</span>(<span class="st">"climbing.toprope"</span>, <span class="st">"climbing.boulder"</span>)])] <span class="ot"><-</span> <span class="st">"no"</span></span>
<span id="cb5-10"><a href="#cb5-10" aria-hidden="true" tabindex="-1"></a>dest<span class="sc">$</span>climbing_type <span class="ot"><-</span> <span class="fu">ifelse</span>(dest<span class="sc">$</span>climbing.toprope <span class="sc">==</span> <span class="st">'yes'</span> <span class="sc">&</span> </span>
<span id="cb5-11"><a href="#cb5-11" aria-hidden="true" tabindex="-1"></a> dest<span class="sc">$</span>climbing.boulder <span class="sc">==</span> <span class="st">"yes"</span>, <span class="st">'Wall and bouldering'</span>,</span>
<span id="cb5-12"><a href="#cb5-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">ifelse</span>(dest<span class="sc">$</span>climbing.toprope <span class="sc">==</span> <span class="st">'yes'</span> <span class="sc">&</span> </span>
<span id="cb5-13"><a href="#cb5-13" aria-hidden="true" tabindex="-1"></a> dest<span class="sc">$</span>climbing.boulder <span class="sc">==</span> <span class="st">"no"</span> , <span class="st">'Wall'</span>,</span>
<span id="cb5-14"><a href="#cb5-14" aria-hidden="true" tabindex="-1"></a> <span class="fu">ifelse</span>(dest<span class="sc">$</span>climbing.toprope <span class="sc">==</span> <span class="st">'no'</span> <span class="sc">&</span> </span>
<span id="cb5-15"><a href="#cb5-15" aria-hidden="true" tabindex="-1"></a> dest<span class="sc">$</span>climbing.boulder <span class="sc">==</span> <span class="st">"yes"</span> ,</span>
<span id="cb5-16"><a href="#cb5-16" aria-hidden="true" tabindex="-1"></a> <span class="st">'Bouldering'</span>, <span class="cn">NA</span>)))</span>
<span id="cb5-17"><a href="#cb5-17" aria-hidden="true" tabindex="-1"></a><span class="co"># Keep only attributes of interest and rename it</span></span>
<span id="cb5-18"><a href="#cb5-18" aria-hidden="true" tabindex="-1"></a>cols <span class="ot"><-</span> <span class="fu">c</span>(<span class="st">"osm_id"</span>, <span class="st">"name"</span>, <span class="st">"climbing_type"</span>, <span class="st">"climbing.length"</span>,</span>
<span id="cb5-19"><a href="#cb5-19" aria-hidden="true" tabindex="-1"></a> <span class="st">"climbing.routes"</span>, <span class="st">"type"</span>, <span class="st">"federation"</span>, <span class="st">"brand"</span>)</span>
<span id="cb5-20"><a href="#cb5-20" aria-hidden="true" tabindex="-1"></a>dest <span class="ot"><-</span> dest[,cols]</span>
<span id="cb5-21"><a href="#cb5-21" aria-hidden="true" tabindex="-1"></a><span class="fu">colnames</span>(dest)[<span class="dv">4</span><span class="sc">:</span><span class="dv">5</span>] <span class="ot"><-</span> <span class="fu">c</span>(<span class="st">"climbing_length"</span>, <span class="st">"climbing_routes"</span>)</span>
<span id="cb5-22"><a href="#cb5-22" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb5-23"><a href="#cb5-23" aria-hidden="true" tabindex="-1"></a><span class="co"># Intersection with bounding box </span></span>
<span id="cb5-24"><a href="#cb5-24" aria-hidden="true" tabindex="-1"></a>poi <span class="ot"><-</span> <span class="fu">st_transform</span>(dest, <span class="dv">2154</span>)</span>
<span id="cb5-25"><a href="#cb5-25" aria-hidden="true" tabindex="-1"></a>poi <span class="ot"><-</span> <span class="fu">st_intersection</span>(poi, paris5k)</span>
<span id="cb5-26"><a href="#cb5-26" aria-hidden="true" tabindex="-1"></a>poi <span class="ot"><-</span> <span class="fu">st_transform</span>(poi, <span class="dv">4326</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
<p>The data preparation allows to prepare origins-destinations layers for travel-time calculation. Origins correspond to the IRIS layer (only type H : 2141 points). Destinations to artificial climbing areas (45 points).</p>
<div class="cell">
</div>
<div class="cell">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb6"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(mapsf)</span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a><span class="co"># Extract centroids from IRIS dedicated to dwellings</span></span>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a>ori <span class="ot"><-</span> <span class="fu">st_centroid</span>(iris)</span>
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a>ori <span class="ot"><-</span> ori[ori<span class="sc">$</span>TYP_IRIS <span class="sc">==</span> <span class="st">"H"</span>,]</span>
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a><span class="co"># Map creation</span></span>
<span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a><span class="fu">par</span>(<span class="at">mar =</span> <span class="fu">c</span>(<span class="dv">0</span>,<span class="dv">0</span>,<span class="dv">0</span>,<span class="dv">0</span>))</span>
<span id="cb6-9"><a href="#cb6-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-10"><a href="#cb6-10" aria-hidden="true" tabindex="-1"></a><span class="co"># Set a map theme (library mapsf)</span></span>
<span id="cb6-11"><a href="#cb6-11" aria-hidden="true" tabindex="-1"></a>my_theme <span class="ot"><-</span> <span class="fu">list</span>(<span class="at">bg =</span> <span class="cn">NA</span>, <span class="at">fg =</span> <span class="cn">NA</span>, <span class="at">mar =</span> <span class="fu">c</span>(<span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>), <span class="at">tab =</span> <span class="cn">TRUE</span>, <span class="at">pos =</span> <span class="st">"left"</span>, </span>
<span id="cb6-12"><a href="#cb6-12" aria-hidden="true" tabindex="-1"></a> <span class="at">inner =</span> <span class="cn">TRUE</span>, <span class="at">line =</span> <span class="fl">1.3</span>, <span class="at">cex =</span> <span class="dv">1</span>, <span class="at">font =</span> <span class="dv">2</span>)</span>
<span id="cb6-13"><a href="#cb6-13" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-14"><a href="#cb6-14" aria-hidden="true" tabindex="-1"></a><span class="co"># Create the map</span></span>
<span id="cb6-15"><a href="#cb6-15" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_init</span>(com, <span class="at">expandBB =</span> <span class="fu">c</span>(<span class="dv">0</span>,<span class="fl">0.4</span>,<span class="dv">0</span>,<span class="dv">0</span>), <span class="at">theme =</span> my_theme)</span>
<span id="cb6-16"><a href="#cb6-16" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-17"><a href="#cb6-17" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_typo</span>(</span>
<span id="cb6-18"><a href="#cb6-18" aria-hidden="true" tabindex="-1"></a> <span class="at">x =</span> iris, <span class="at">var =</span> <span class="st">"TYP_IRIS"</span>, </span>
<span id="cb6-19"><a href="#cb6-19" aria-hidden="true" tabindex="-1"></a> <span class="at">pal =</span> <span class="fu">c</span>(<span class="st">"peachpuff"</span>, <span class="st">"#feb8ff"</span>, <span class="st">"#f0e6f0"</span>, <span class="st">"#f1f7ab"</span>), <span class="at">lwd =</span> <span class="fl">0.25</span>,</span>
<span id="cb6-20"><a href="#cb6-20" aria-hidden="true" tabindex="-1"></a> <span class="at">val_order =</span> <span class="fu">c</span>(<span class="st">"H"</span>, <span class="st">"A"</span>, <span class="st">"D"</span>, <span class="st">"Z"</span>), <span class="at">border =</span> <span class="st">"white"</span>, <span class="at">leg_pos =</span> <span class="fu">c</span>(<span class="dv">631000</span>, <span class="dv">6872000</span>),</span>
<span id="cb6-21"><a href="#cb6-21" aria-hidden="true" tabindex="-1"></a> <span class="at">leg_title =</span> <span class="st">"IRIS types (H = dwellings)"</span>, <span class="at">add =</span> <span class="cn">TRUE</span>)</span>
<span id="cb6-22"><a href="#cb6-22" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-23"><a href="#cb6-23" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_map</span>(ori, <span class="at">pch =</span> <span class="dv">20</span>, <span class="at">col =</span> <span class="st">"red"</span>, <span class="at">cex =</span> .<span class="dv">2</span>, <span class="at">add =</span> <span class="cn">TRUE</span>)</span>
<span id="cb6-24"><a href="#cb6-24" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-25"><a href="#cb6-25" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_legend</span>(</span>
<span id="cb6-26"><a href="#cb6-26" aria-hidden="true" tabindex="-1"></a> <span class="at">type =</span> <span class="st">"symb"</span>, <span class="at">pos =</span> <span class="fu">c</span>(<span class="dv">631000</span>, <span class="dv">6864000</span>), <span class="at">val =</span> <span class="fu">c</span>(<span class="st">"H"</span>, <span class="st">"H"</span>),</span>
<span id="cb6-27"><a href="#cb6-27" aria-hidden="true" tabindex="-1"></a> <span class="at">pt_pch =</span> <span class="fu">c</span>(<span class="dv">20</span>,<span class="dv">20</span>), <span class="at">pt_cex =</span>.<span class="dv">2</span>, <span class="at">title =</span> <span class="st">"Origins : IRIS centroids type H"</span>,</span>
<span id="cb6-28"><a href="#cb6-28" aria-hidden="true" tabindex="-1"></a> <span class="at">pal =</span> <span class="fu">c</span>(<span class="st">"red"</span>, <span class="st">"red"</span>))</span>
<span id="cb6-29"><a href="#cb6-29" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-30"><a href="#cb6-30" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_typo</span>(<span class="at">x =</span> poi, <span class="at">var =</span> <span class="st">"federation"</span>, <span class="at">pch =</span> <span class="dv">21</span>, <span class="at">cex =</span> .<span class="dv">7</span>,</span>
<span id="cb6-31"><a href="#cb6-31" aria-hidden="true" tabindex="-1"></a> <span class="at">val_order =</span> <span class="fu">c</span>(<span class="st">"Private"</span>, <span class="st">"FSGT"</span>, <span class="st">"FFME"</span>),</span>
<span id="cb6-32"><a href="#cb6-32" aria-hidden="true" tabindex="-1"></a> <span class="at">pal =</span> <span class="fu">c</span>(<span class="st">"#377eb8"</span>, <span class="st">"#e41a1c"</span>, <span class="st">"#ff7f00"</span>),</span>
<span id="cb6-33"><a href="#cb6-33" aria-hidden="true" tabindex="-1"></a> <span class="at">leg_title =</span> <span class="st">"Destinations:</span><span class="sc">\n</span><span class="st">Artificial climbing areas"</span>,</span>
<span id="cb6-34"><a href="#cb6-34" aria-hidden="true" tabindex="-1"></a> <span class="at">leg_pos =</span> <span class="fu">c</span>(<span class="dv">631000</span>, <span class="dv">6860000</span>),</span>
<span id="cb6-35"><a href="#cb6-35" aria-hidden="true" tabindex="-1"></a> <span class="at">add =</span> <span class="cn">TRUE</span>)</span>
<span id="cb6-36"><a href="#cb6-36" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-37"><a href="#cb6-37" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_map</span>(com, <span class="at">col =</span> <span class="cn">NA</span>, <span class="at">border =</span> <span class="st">"black"</span>, <span class="at">add =</span> <span class="cn">TRUE</span>)</span>
<span id="cb6-38"><a href="#cb6-38" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-39"><a href="#cb6-39" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_title</span>(<span class="st">"Layers presentation for origins-destinations calculation"</span>)</span>
<span id="cb6-40"><a href="#cb6-40" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_scale</span>(<span class="at">size =</span> <span class="dv">5</span>, <span class="at">col =</span> <span class="st">"black"</span>, <span class="at">pos =</span> <span class="st">"bottomright"</span>)</span>
<span id="cb6-41"><a href="#cb6-41" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_credits</span>(<span class="fu">paste0</span>(<span class="st">"Sources : © OpenStreetMap and Contributors, IGN, INSEE, 2022</span><span class="sc">\n</span><span class="st">"</span>,</span>
<span id="cb6-42"><a href="#cb6-42" aria-hidden="true" tabindex="-1"></a> <span class="st">"Realisation : Ronan Ysebaert, 2022"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<p><img src="index_files/figure-html/unnamed-chunk-7-1.png" class="img-fluid" style="width:100.0%"></p>
</div>
</div>
</section>
<section id="travel-time-calculations-with-osrm" class="level2">
<h2 class="anchored" data-anchor-id="travel-time-calculations-with-osrm">Travel-time calculations with OSRM</h2>
<p>Origins and destinations required to compute travel-time calculations are now available. The computation is realized using the <code>osrm</code> R package (<span class="citation" data-cites="osrm">Giraud (<a href="#ref-osrm" role="doc-biblioref">2022b</a>)</span>). This package allows the computation of routes, trips, isochrones and travel distances matrices (travel time and kilometer distance).</p>
<p>Considering that the input data are quite important (more than 2000 origin points and 48 destination points) and to avoid to overload the OSRM demo server, I have run my own instance of OSRM based on a docker container solution. The procedure to implement this solution is explained in the <a href="https://github.com/Project-OSRM/osrm-backend#using-docker" title="Run OSRM with docker">following documentation</a>, or more specifically for Windows <a href="https://gist.github.com/AlexandraKapp/e0eee2beacc93e765113aff43ec77789" title="How to set up your own OSRM backend with Docker on Windows">here</a>.</p>
<p>Once it is done, the connection to the routing engine is operational locally (with the URL <code>http://localhost:5000/</code>` for me).</p>
<p>With OSRM, it is possible to choose several profiles depending on the routing we want to use (car, bike, walking). In our case, we choose the bike profile: Cycling is a widespread practice (with public transport) for climbers to reach their activities in this kind of urban context. Moreover, it allows also to avoid to use the car profile, which underestimates the travel-time in metropolitan areas (traffic congestion not taken into account).</p>
<p>The bicycle profile is described in the <a href="https://github.com/Project-OSRM/osrm-backend/blob/master/profiles/bicycle.lua" title="OSRM bicycle profile">github OSRM repository</a>. Basically, the default speed is 15 km/h. It avoids the access to highways, reduce the driving speed by 30 % for unsafe roads. It is important to keep in mind that landforms (elevation) are not considered in the default profile. Some thoughts and solutions exist on the subject, using elevation rasters (<a href="https://www.liedman.net/2015/04/13/add-elevation-data-to-osrm/" title="Adding elevation data to OSRM">Liedman (2022)</a> ; <a href="https://blog.mapbox.com/elevation-aware-routing-profiles-in-mapbox-directions-21e182a85165" title="Elevation-aware routing profiles in Mapbox Directions">Mapbox (2015)</a>). This will not be considered here.</p>
<section id="iris-to-climbing-areas" class="level3">
<h3 class="anchored" data-anchor-id="iris-to-climbing-areas">IRIS to climbing areas</h3>
<p>The code below compute travel-time calculation between the geometric centre of IRIS (<code>ori</code>) and artificial climbing areas (<code>dest</code>). It is done for all climbing structures and reproduced according to the type of climbing structure : private or associative structures. For associative structures, we distinguish the FSGT and FFME federations, that do not have exactly the same goals in term of practice.</p>
<p>Resulting travel-time matrixes are exported in the <a href="https://github.com/rysebaert/climbing_paris/tree/main/data-conso">data-conso</a> folder for other possible uses (and to avoid running these important calculations systematically).</p>
<div class="cell">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="co"># 4. Origin - Destination calculation with OSRM ----</span></span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(osrm)</span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a><span class="co"># Manage ids</span></span>
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a><span class="fu">row.names</span>(ori) <span class="ot"><-</span> ori<span class="sc">$</span>CODE_IRIS</span>
<span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-7"><a href="#cb7-7" aria-hidden="true" tabindex="-1"></a><span class="co"># Connexion to osrm local server (the osrm container must running under docker)</span></span>
<span id="cb7-8"><a href="#cb7-8" aria-hidden="true" tabindex="-1"></a><span class="fu">options</span>(<span class="at">osrm.server =</span> <span class="st">"http://localhost:5000/"</span>, <span class="at">osrm.profile =</span> <span class="st">"bike"</span>)</span>
<span id="cb7-9"><a href="#cb7-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-10"><a href="#cb7-10" aria-hidden="true" tabindex="-1"></a><span class="co"># Origin-destination calculation</span></span>
<span id="cb7-11"><a href="#cb7-11" aria-hidden="true" tabindex="-1"></a><span class="co"># All structures</span></span>
<span id="cb7-12"><a href="#cb7-12" aria-hidden="true" tabindex="-1"></a>df <span class="ot"><-</span> <span class="fu">osrmTable</span>(<span class="at">src =</span> ori, <span class="at">dst =</span> dest, <span class="at">measure =</span> <span class="st">"duration"</span>)</span>
<span id="cb7-13"><a href="#cb7-13" aria-hidden="true" tabindex="-1"></a>df <span class="ot"><-</span> <span class="fu">data.frame</span>(df<span class="sc">$</span>duration)</span>
<span id="cb7-14"><a href="#cb7-14" aria-hidden="true" tabindex="-1"></a><span class="fu">colnames</span>(df) <span class="ot"><-</span> <span class="fu">as.character</span>(dest<span class="sc">$</span>osm_id)</span>
<span id="cb7-15"><a href="#cb7-15" aria-hidden="true" tabindex="-1"></a><span class="fu">row.names</span>(df) <span class="ot"><-</span> <span class="fu">as.character</span>(ori<span class="sc">$</span>CODE_IRIS)</span>
<span id="cb7-16"><a href="#cb7-16" aria-hidden="true" tabindex="-1"></a><span class="fu">write.csv</span>(df, <span class="st">"data-conso/bike-duration.csv"</span>)</span>
<span id="cb7-17"><a href="#cb7-17" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-18"><a href="#cb7-18" aria-hidden="true" tabindex="-1"></a><span class="co"># Private structures</span></span>
<span id="cb7-19"><a href="#cb7-19" aria-hidden="true" tabindex="-1"></a>dest_priv <span class="ot"><-</span> dest[dest<span class="sc">$</span>type <span class="sc">==</span> <span class="st">"Speculative structure"</span>,] </span>
<span id="cb7-20"><a href="#cb7-20" aria-hidden="true" tabindex="-1"></a>df2 <span class="ot"><-</span> <span class="fu">osrmTable</span>(<span class="at">src =</span> ori, <span class="at">dst =</span> dest_priv, <span class="at">measure =</span> <span class="st">"duration"</span>)</span>
<span id="cb7-21"><a href="#cb7-21" aria-hidden="true" tabindex="-1"></a>df2 <span class="ot"><-</span> <span class="fu">data.frame</span>(df2<span class="sc">$</span>duration)</span>
<span id="cb7-22"><a href="#cb7-22" aria-hidden="true" tabindex="-1"></a><span class="fu">colnames</span>(df2) <span class="ot"><-</span> <span class="fu">as.character</span>(dest_priv<span class="sc">$</span>osm_id)</span>
<span id="cb7-23"><a href="#cb7-23" aria-hidden="true" tabindex="-1"></a><span class="fu">row.names</span>(df2) <span class="ot"><-</span> <span class="fu">as.character</span>(ori<span class="sc">$</span>CODE_IRIS)</span>
<span id="cb7-24"><a href="#cb7-24" aria-hidden="true" tabindex="-1"></a><span class="fu">write.csv</span>(df2, <span class="st">"data-conso/bike-duration-priv.csv"</span>)</span>
<span id="cb7-25"><a href="#cb7-25" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-26"><a href="#cb7-26" aria-hidden="true" tabindex="-1"></a><span class="co"># FFME</span></span>
<span id="cb7-27"><a href="#cb7-27" aria-hidden="true" tabindex="-1"></a>dest_asso <span class="ot"><-</span>dest[dest<span class="sc">$</span>type <span class="sc">==</span> <span class="st">"Associative structure"</span>,] </span>
<span id="cb7-28"><a href="#cb7-28" aria-hidden="true" tabindex="-1"></a>dest_ffme <span class="ot"><-</span> dest_asso[dest_asso<span class="sc">$</span>federation <span class="sc">==</span> <span class="st">"FFME"</span>,]</span>
<span id="cb7-29"><a href="#cb7-29" aria-hidden="true" tabindex="-1"></a>df3 <span class="ot"><-</span> <span class="fu">osrmTable</span>(<span class="at">src =</span> ori, <span class="at">dst =</span> dest_ffme, <span class="at">measure =</span> <span class="st">"duration"</span>)</span>
<span id="cb7-30"><a href="#cb7-30" aria-hidden="true" tabindex="-1"></a>df3 <span class="ot"><-</span> <span class="fu">data.frame</span>(df3<span class="sc">$</span>duration)</span>
<span id="cb7-31"><a href="#cb7-31" aria-hidden="true" tabindex="-1"></a><span class="fu">colnames</span>(df3) <span class="ot"><-</span> <span class="fu">as.character</span>(dest_ffme<span class="sc">$</span>osm_id)</span>
<span id="cb7-32"><a href="#cb7-32" aria-hidden="true" tabindex="-1"></a><span class="fu">row.names</span>(df3) <span class="ot"><-</span> <span class="fu">as.character</span>(ori<span class="sc">$</span>CODE_IRIS)</span>
<span id="cb7-33"><a href="#cb7-33" aria-hidden="true" tabindex="-1"></a><span class="fu">write.csv</span>(df3, <span class="st">"data-conso/bike-duration-ffme.csv"</span>)</span>
<span id="cb7-34"><a href="#cb7-34" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-35"><a href="#cb7-35" aria-hidden="true" tabindex="-1"></a><span class="co"># FSGT</span></span>
<span id="cb7-36"><a href="#cb7-36" aria-hidden="true" tabindex="-1"></a>dest_fsgt <span class="ot"><-</span> dest_asso[dest_asso<span class="sc">$</span>federation <span class="sc">==</span> <span class="st">"FSGT"</span>,]</span>
<span id="cb7-37"><a href="#cb7-37" aria-hidden="true" tabindex="-1"></a>df4 <span class="ot"><-</span> <span class="fu">osrmTable</span>(<span class="at">src =</span> ori, <span class="at">dst =</span> dest_fsgt, <span class="at">measure =</span> <span class="st">"duration"</span>)</span>
<span id="cb7-38"><a href="#cb7-38" aria-hidden="true" tabindex="-1"></a>df4 <span class="ot"><-</span> <span class="fu">data.frame</span>(df4<span class="sc">$</span>duration)</span>
<span id="cb7-39"><a href="#cb7-39" aria-hidden="true" tabindex="-1"></a><span class="fu">colnames</span>(df4) <span class="ot"><-</span> <span class="fu">as.character</span>(dest_fsgt<span class="sc">$</span>osm_id)</span>
<span id="cb7-40"><a href="#cb7-40" aria-hidden="true" tabindex="-1"></a><span class="fu">row.names</span>(df4) <span class="ot"><-</span> <span class="fu">as.character</span>(ori<span class="sc">$</span>CODE_IRIS)</span>
<span id="cb7-41"><a href="#cb7-41" aria-hidden="true" tabindex="-1"></a><span class="fu">write.csv</span>(df4, <span class="st">"data-conso/bike-duration-fsgt.csv"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
<p>This heavy matrix is then manipulated to extract for each IRIS the following information :</p>
<ul>
<li><p>Name of the nearest climbing structure by bike.</p></li>
<li><p>Type of manager (private, FFME or FSGT).</p></li>
<li><p>Time to reach it (in minutes).</p></li>
<li><p>Number of artificial climbing areas at less than 15 minutes by bike (N).</p></li>
</ul>
<p>This calculation is done for all climbing structures (ALL), for private ones (PRIV), for those held by FFME federation (FFME) and for those held by the FSGT federation (FSGT). It is done with R base code. A function would reduce considerably the code length… Nevermind, it is not the aim of the proof ;)</p>
<div class="cell">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="co"># 5. Accessibility indicator creation (IRIS) ----</span></span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a><span class="co"># Name of the nearest structure</span></span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a>df <span class="ot"><-</span> <span class="fu">read.csv</span>(<span class="st">"data-conso/bike-duration.csv"</span>, <span class="at">row.names =</span> <span class="st">"X"</span>)</span>
<span id="cb8-4"><a href="#cb8-4" aria-hidden="true" tabindex="-1"></a><span class="fu">colnames</span>(df) <span class="ot"><-</span> <span class="fu">as.character</span>(dest<span class="sc">$</span>osm_id)</span>
<span id="cb8-5"><a href="#cb8-5" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> <span class="fu">colnames</span>(df)[<span class="fu">apply</span>(df, <span class="dv">1</span>, which.min)] <span class="co"># Name</span></span>
<span id="cb8-6"><a href="#cb8-6" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> <span class="fu">data.frame</span>(osm_id, <span class="at">stringsAsFactors =</span> <span class="cn">FALSE</span>)</span>
<span id="cb8-7"><a href="#cb8-7" aria-hidden="true" tabindex="-1"></a>osm_id<span class="sc">$</span>iris <span class="ot"><-</span> <span class="fu">row.names</span>(df)</span>
<span id="cb8-8"><a href="#cb8-8" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> <span class="fu">merge</span>(osm_id, poi[,<span class="fu">c</span>(<span class="st">"osm_id"</span>, <span class="st">"name"</span>, <span class="st">"federation"</span>)], </span>
<span id="cb8-9"><a href="#cb8-9" aria-hidden="true" tabindex="-1"></a> <span class="at">by =</span> <span class="st">"osm_id"</span>, <span class="at">all.x =</span> <span class="cn">TRUE</span>)</span>
<span id="cb8-10"><a href="#cb8-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-11"><a href="#cb8-11" aria-hidden="true" tabindex="-1"></a><span class="co"># Time to the nearest climbing area</span></span>
<span id="cb8-12"><a href="#cb8-12" aria-hidden="true" tabindex="-1"></a>time <span class="ot"><-</span> <span class="fu">apply</span>(df, <span class="dv">1</span>, min) <span class="co"># Time</span></span>
<span id="cb8-13"><a href="#cb8-13" aria-hidden="true" tabindex="-1"></a>time <span class="ot"><-</span> <span class="fu">data.frame</span>(time, <span class="at">stringsAsFactors =</span> <span class="cn">FALSE</span>)</span>
<span id="cb8-14"><a href="#cb8-14" aria-hidden="true" tabindex="-1"></a>time<span class="sc">$</span>iris <span class="ot"><-</span> <span class="fu">row.names</span>(time)</span>
<span id="cb8-15"><a href="#cb8-15" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> <span class="fu">merge</span>(osm_id, time, <span class="at">by =</span> <span class="st">"iris"</span>, <span class="at">all.x =</span> <span class="cn">TRUE</span>)</span>
<span id="cb8-16"><a href="#cb8-16" aria-hidden="true" tabindex="-1"></a>osm_id<span class="sc">$</span>geometry <span class="ot"><-</span> <span class="cn">NULL</span></span>
<span id="cb8-17"><a href="#cb8-17" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-18"><a href="#cb8-18" aria-hidden="true" tabindex="-1"></a><span class="co"># Number of climbing area at less than 15 minutes by bike</span></span>
<span id="cb8-19"><a href="#cb8-19" aria-hidden="true" tabindex="-1"></a>n15mn <span class="ot"><-</span> df</span>
<span id="cb8-20"><a href="#cb8-20" aria-hidden="true" tabindex="-1"></a>n15mn <span class="ot"><-</span> <span class="fu">data.frame</span>(df, <span class="at">stringsAsFactors =</span> <span class="cn">FALSE</span>)</span>
<span id="cb8-21"><a href="#cb8-21" aria-hidden="true" tabindex="-1"></a>n15mn[n15mn <span class="sc"><=</span> <span class="dv">15</span>] <span class="ot"><-</span> <span class="dv">1</span></span>
<span id="cb8-22"><a href="#cb8-22" aria-hidden="true" tabindex="-1"></a>n15mn[n15mn <span class="sc">></span> <span class="dv">15</span>] <span class="ot"><-</span> <span class="dv">0</span></span>
<span id="cb8-23"><a href="#cb8-23" aria-hidden="true" tabindex="-1"></a>n15mn<span class="sc">$</span>N <span class="ot"><-</span> <span class="fu">rowSums</span>(n15mn)</span>
<span id="cb8-24"><a href="#cb8-24" aria-hidden="true" tabindex="-1"></a>n15mn<span class="sc">$</span>iris <span class="ot"><-</span> <span class="fu">row.names</span>(n15mn)</span>
<span id="cb8-25"><a href="#cb8-25" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> <span class="fu">merge</span>(osm_id, n15mn[,<span class="fu">c</span>(<span class="st">"iris"</span>, <span class="st">"N"</span>)], <span class="at">by =</span> <span class="st">"iris"</span>,</span>
<span id="cb8-26"><a href="#cb8-26" aria-hidden="true" tabindex="-1"></a> <span class="at">all.x =</span> <span class="cn">TRUE</span>)</span>
<span id="cb8-27"><a href="#cb8-27" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> osm_id[,<span class="fu">c</span>(<span class="dv">1</span>,<span class="dv">3</span><span class="sc">:</span><span class="dv">6</span>)]</span>
<span id="cb8-28"><a href="#cb8-28" aria-hidden="true" tabindex="-1"></a><span class="fu">colnames</span>(osm_id) <span class="ot"><-</span> <span class="fu">c</span>(<span class="st">"CODE_IRIS"</span>, <span class="st">"ALL_NAME"</span>, <span class="st">"TYPE_STRUCT"</span>, <span class="st">"ALL_TIME"</span>,</span>
<span id="cb8-29"><a href="#cb8-29" aria-hidden="true" tabindex="-1"></a> <span class="st">"N_15MN"</span>)</span>
<span id="cb8-30"><a href="#cb8-30" aria-hidden="true" tabindex="-1"></a>iris <span class="ot"><-</span> <span class="fu">merge</span>(iris, osm_id, <span class="at">by =</span> <span class="st">"CODE_IRIS"</span>, <span class="at">all.x =</span> <span class="cn">TRUE</span>)</span>
<span id="cb8-31"><a href="#cb8-31" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-32"><a href="#cb8-32" aria-hidden="true" tabindex="-1"></a><span class="co"># Private climbing club (fees $$$)</span></span>
<span id="cb8-33"><a href="#cb8-33" aria-hidden="true" tabindex="-1"></a><span class="co"># Name of the nearest structure</span></span>
<span id="cb8-34"><a href="#cb8-34" aria-hidden="true" tabindex="-1"></a>df2 <span class="ot"><-</span> <span class="fu">read.csv</span>(<span class="st">"data-conso/bike-duration-priv.csv"</span>, <span class="at">row.names =</span> <span class="st">"X"</span>)</span>
<span id="cb8-35"><a href="#cb8-35" aria-hidden="true" tabindex="-1"></a><span class="fu">colnames</span>(df2) <span class="ot"><-</span> <span class="fu">as.character</span>(dest_priv<span class="sc">$</span>osm_id)</span>
<span id="cb8-36"><a href="#cb8-36" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> <span class="fu">colnames</span>(df2)[<span class="fu">apply</span>(df2, <span class="dv">1</span>, which.min)] <span class="co"># Name</span></span>
<span id="cb8-37"><a href="#cb8-37" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> <span class="fu">data.frame</span>(osm_id, <span class="at">stringsAsFactors =</span> <span class="cn">FALSE</span>)</span>
<span id="cb8-38"><a href="#cb8-38" aria-hidden="true" tabindex="-1"></a>osm_id<span class="sc">$</span>iris <span class="ot"><-</span> <span class="fu">row.names</span>(df2)</span>
<span id="cb8-39"><a href="#cb8-39" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> <span class="fu">merge</span>(osm_id, poi[,<span class="fu">c</span>(<span class="st">"osm_id"</span>, <span class="st">"name"</span>, <span class="st">"type"</span>)], </span>
<span id="cb8-40"><a href="#cb8-40" aria-hidden="true" tabindex="-1"></a> <span class="at">by =</span> <span class="st">"osm_id"</span>, <span class="at">all.x =</span> <span class="cn">TRUE</span>)</span>
<span id="cb8-41"><a href="#cb8-41" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-42"><a href="#cb8-42" aria-hidden="true" tabindex="-1"></a><span class="co"># Time to the nearest climbing area</span></span>
<span id="cb8-43"><a href="#cb8-43" aria-hidden="true" tabindex="-1"></a>time <span class="ot"><-</span> <span class="fu">apply</span>(df2, <span class="dv">1</span>, min) <span class="co"># Time</span></span>
<span id="cb8-44"><a href="#cb8-44" aria-hidden="true" tabindex="-1"></a>time <span class="ot"><-</span> <span class="fu">data.frame</span>(time, <span class="at">stringsAsFactors =</span> <span class="cn">FALSE</span>)</span>
<span id="cb8-45"><a href="#cb8-45" aria-hidden="true" tabindex="-1"></a>time<span class="sc">$</span>iris <span class="ot"><-</span> <span class="fu">row.names</span>(time)</span>
<span id="cb8-46"><a href="#cb8-46" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> <span class="fu">merge</span>(osm_id, time, <span class="at">by =</span> <span class="st">"iris"</span>, <span class="at">all.x =</span> <span class="cn">TRUE</span>)</span>
<span id="cb8-47"><a href="#cb8-47" aria-hidden="true" tabindex="-1"></a>osm_id<span class="sc">$</span>geometry <span class="ot"><-</span> <span class="cn">NULL</span></span>
<span id="cb8-48"><a href="#cb8-48" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-49"><a href="#cb8-49" aria-hidden="true" tabindex="-1"></a><span class="co"># Number of climbing area at less than 15 minutes by bike</span></span>
<span id="cb8-50"><a href="#cb8-50" aria-hidden="true" tabindex="-1"></a>n15mn <span class="ot"><-</span> df2</span>
<span id="cb8-51"><a href="#cb8-51" aria-hidden="true" tabindex="-1"></a>n15mn <span class="ot"><-</span> <span class="fu">data.frame</span>(df2, <span class="at">stringsAsFactors =</span> <span class="cn">FALSE</span>)</span>
<span id="cb8-52"><a href="#cb8-52" aria-hidden="true" tabindex="-1"></a>n15mn[n15mn <span class="sc"><=</span> <span class="dv">15</span>] <span class="ot"><-</span> <span class="dv">1</span></span>
<span id="cb8-53"><a href="#cb8-53" aria-hidden="true" tabindex="-1"></a>n15mn[n15mn <span class="sc">></span> <span class="dv">15</span>] <span class="ot"><-</span> <span class="dv">0</span></span>
<span id="cb8-54"><a href="#cb8-54" aria-hidden="true" tabindex="-1"></a>n15mn<span class="sc">$</span>N <span class="ot"><-</span> <span class="fu">rowSums</span>(n15mn)</span>
<span id="cb8-55"><a href="#cb8-55" aria-hidden="true" tabindex="-1"></a>n15mn<span class="sc">$</span>iris <span class="ot"><-</span> <span class="fu">row.names</span>(n15mn)</span>
<span id="cb8-56"><a href="#cb8-56" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> <span class="fu">merge</span>(osm_id, n15mn[,<span class="fu">c</span>(<span class="st">"iris"</span>, <span class="st">"N"</span>)], <span class="at">by =</span> <span class="st">"iris"</span>,</span>
<span id="cb8-57"><a href="#cb8-57" aria-hidden="true" tabindex="-1"></a> <span class="at">all.x =</span> <span class="cn">TRUE</span>)</span>
<span id="cb8-58"><a href="#cb8-58" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> osm_id[,<span class="fu">c</span>(<span class="dv">1</span>,<span class="dv">3</span>,<span class="dv">5</span><span class="sc">:</span><span class="dv">6</span>)]</span>
<span id="cb8-59"><a href="#cb8-59" aria-hidden="true" tabindex="-1"></a><span class="fu">colnames</span>(osm_id) <span class="ot"><-</span> <span class="fu">c</span>(<span class="st">"CODE_IRIS"</span>, <span class="st">"PRIV_NAME"</span>, <span class="st">"PRIV_TIME"</span>,</span>
<span id="cb8-60"><a href="#cb8-60" aria-hidden="true" tabindex="-1"></a> <span class="st">"N_PRIV_15MN"</span>)</span>
<span id="cb8-61"><a href="#cb8-61" aria-hidden="true" tabindex="-1"></a>iris <span class="ot"><-</span> <span class="fu">merge</span>(iris, osm_id, <span class="at">by =</span> <span class="st">"CODE_IRIS"</span>, <span class="at">all.x =</span> <span class="cn">TRUE</span>)</span>
<span id="cb8-62"><a href="#cb8-62" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-63"><a href="#cb8-63" aria-hidden="true" tabindex="-1"></a><span class="co"># FFME associative structure</span></span>
<span id="cb8-64"><a href="#cb8-64" aria-hidden="true" tabindex="-1"></a><span class="co"># Name of the nearest structure</span></span>
<span id="cb8-65"><a href="#cb8-65" aria-hidden="true" tabindex="-1"></a>df3 <span class="ot"><-</span> <span class="fu">read.csv</span>(<span class="st">"data-conso/bike-duration-ffme.csv"</span>, <span class="at">row.names =</span> <span class="st">"X"</span>)</span>
<span id="cb8-66"><a href="#cb8-66" aria-hidden="true" tabindex="-1"></a><span class="fu">colnames</span>(df3) <span class="ot"><-</span> <span class="fu">as.character</span>(dest_ffme<span class="sc">$</span>osm_id)</span>
<span id="cb8-67"><a href="#cb8-67" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> <span class="fu">colnames</span>(df3)[<span class="fu">apply</span>(df3, <span class="dv">1</span>, which.min)] <span class="co"># Name</span></span>
<span id="cb8-68"><a href="#cb8-68" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> <span class="fu">data.frame</span>(osm_id, <span class="at">stringsAsFactors =</span> <span class="cn">FALSE</span>)</span>
<span id="cb8-69"><a href="#cb8-69" aria-hidden="true" tabindex="-1"></a>osm_id<span class="sc">$</span>iris <span class="ot"><-</span> <span class="fu">row.names</span>(df3)</span>
<span id="cb8-70"><a href="#cb8-70" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> <span class="fu">merge</span>(osm_id, poi[,<span class="fu">c</span>(<span class="st">"osm_id"</span>, <span class="st">"name"</span>, <span class="st">"type"</span>)], </span>
<span id="cb8-71"><a href="#cb8-71" aria-hidden="true" tabindex="-1"></a> <span class="at">by =</span> <span class="st">"osm_id"</span>, <span class="at">all.x =</span> <span class="cn">TRUE</span>)</span>
<span id="cb8-72"><a href="#cb8-72" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-73"><a href="#cb8-73" aria-hidden="true" tabindex="-1"></a><span class="co"># Time to the nearest climbing area</span></span>
<span id="cb8-74"><a href="#cb8-74" aria-hidden="true" tabindex="-1"></a>time <span class="ot"><-</span> <span class="fu">apply</span>(df3, <span class="dv">1</span>, min) <span class="co"># Time</span></span>
<span id="cb8-75"><a href="#cb8-75" aria-hidden="true" tabindex="-1"></a>time <span class="ot"><-</span> <span class="fu">data.frame</span>(time, <span class="at">stringsAsFactors =</span> <span class="cn">FALSE</span>)</span>
<span id="cb8-76"><a href="#cb8-76" aria-hidden="true" tabindex="-1"></a>time<span class="sc">$</span>iris <span class="ot"><-</span> <span class="fu">row.names</span>(time)</span>
<span id="cb8-77"><a href="#cb8-77" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> <span class="fu">merge</span>(osm_id, time, <span class="at">by =</span> <span class="st">"iris"</span>, <span class="at">all.x =</span> <span class="cn">TRUE</span>)</span>
<span id="cb8-78"><a href="#cb8-78" aria-hidden="true" tabindex="-1"></a>osm_id<span class="sc">$</span>geometry <span class="ot"><-</span> <span class="cn">NULL</span></span>
<span id="cb8-79"><a href="#cb8-79" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-80"><a href="#cb8-80" aria-hidden="true" tabindex="-1"></a><span class="co"># Number of climbing area at less than 15 minutes by bike</span></span>
<span id="cb8-81"><a href="#cb8-81" aria-hidden="true" tabindex="-1"></a>n15mn <span class="ot"><-</span> df3</span>
<span id="cb8-82"><a href="#cb8-82" aria-hidden="true" tabindex="-1"></a>n15mn <span class="ot"><-</span> <span class="fu">data.frame</span>(df3, <span class="at">stringsAsFactors =</span> <span class="cn">FALSE</span>)</span>
<span id="cb8-83"><a href="#cb8-83" aria-hidden="true" tabindex="-1"></a>n15mn[n15mn <span class="sc"><=</span> <span class="dv">15</span>] <span class="ot"><-</span> <span class="dv">1</span></span>
<span id="cb8-84"><a href="#cb8-84" aria-hidden="true" tabindex="-1"></a>n15mn[n15mn <span class="sc">></span> <span class="dv">15</span>] <span class="ot"><-</span> <span class="dv">0</span></span>
<span id="cb8-85"><a href="#cb8-85" aria-hidden="true" tabindex="-1"></a>n15mn<span class="sc">$</span>N <span class="ot"><-</span> <span class="fu">rowSums</span>(n15mn)</span>
<span id="cb8-86"><a href="#cb8-86" aria-hidden="true" tabindex="-1"></a>n15mn<span class="sc">$</span>iris <span class="ot"><-</span> <span class="fu">row.names</span>(n15mn)</span>
<span id="cb8-87"><a href="#cb8-87" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> <span class="fu">merge</span>(osm_id, n15mn[,<span class="fu">c</span>(<span class="st">"iris"</span>, <span class="st">"N"</span>)], <span class="at">by =</span> <span class="st">"iris"</span>,</span>
<span id="cb8-88"><a href="#cb8-88" aria-hidden="true" tabindex="-1"></a> <span class="at">all.x =</span> <span class="cn">TRUE</span>)</span>
<span id="cb8-89"><a href="#cb8-89" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> osm_id[,<span class="fu">c</span>(<span class="dv">1</span>,<span class="dv">3</span>,<span class="dv">5</span><span class="sc">:</span><span class="dv">6</span>)]</span>
<span id="cb8-90"><a href="#cb8-90" aria-hidden="true" tabindex="-1"></a><span class="fu">colnames</span>(osm_id) <span class="ot"><-</span> <span class="fu">c</span>(<span class="st">"CODE_IRIS"</span>, <span class="st">"FFME_NAME"</span>, <span class="st">"FFME_TIME"</span>,</span>
<span id="cb8-91"><a href="#cb8-91" aria-hidden="true" tabindex="-1"></a> <span class="st">"N_FFME_15MN"</span>)</span>
<span id="cb8-92"><a href="#cb8-92" aria-hidden="true" tabindex="-1"></a>iris <span class="ot"><-</span> <span class="fu">merge</span>(iris, osm_id, <span class="at">by =</span> <span class="st">"CODE_IRIS"</span>, <span class="at">all.x =</span> <span class="cn">TRUE</span>)</span>
<span id="cb8-93"><a href="#cb8-93" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-94"><a href="#cb8-94" aria-hidden="true" tabindex="-1"></a><span class="co"># FSGT associative structure</span></span>
<span id="cb8-95"><a href="#cb8-95" aria-hidden="true" tabindex="-1"></a><span class="co"># Name of the nearest structure</span></span>
<span id="cb8-96"><a href="#cb8-96" aria-hidden="true" tabindex="-1"></a>df4 <span class="ot"><-</span> <span class="fu">read.csv</span>(<span class="st">"data-conso/bike-duration-fsgt.csv"</span>, <span class="at">row.names =</span> <span class="st">"X"</span>)</span>
<span id="cb8-97"><a href="#cb8-97" aria-hidden="true" tabindex="-1"></a><span class="fu">colnames</span>(df4) <span class="ot"><-</span> <span class="fu">as.character</span>(dest_fsgt<span class="sc">$</span>osm_id)</span>
<span id="cb8-98"><a href="#cb8-98" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> <span class="fu">colnames</span>(df4)[<span class="fu">apply</span>(df4, <span class="dv">1</span>, which.min)] <span class="co"># Name</span></span>
<span id="cb8-99"><a href="#cb8-99" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> <span class="fu">data.frame</span>(osm_id, <span class="at">stringsAsFactors =</span> <span class="cn">FALSE</span>)</span>
<span id="cb8-100"><a href="#cb8-100" aria-hidden="true" tabindex="-1"></a>osm_id<span class="sc">$</span>iris <span class="ot"><-</span> <span class="fu">row.names</span>(df4)</span>
<span id="cb8-101"><a href="#cb8-101" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> <span class="fu">merge</span>(osm_id, poi[,<span class="fu">c</span>(<span class="st">"osm_id"</span>, <span class="st">"name"</span>, <span class="st">"type"</span>)], </span>
<span id="cb8-102"><a href="#cb8-102" aria-hidden="true" tabindex="-1"></a> <span class="at">by =</span> <span class="st">"osm_id"</span>, <span class="at">all.x =</span> <span class="cn">TRUE</span>)</span>
<span id="cb8-103"><a href="#cb8-103" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-104"><a href="#cb8-104" aria-hidden="true" tabindex="-1"></a><span class="co"># Time to the nearest climbing area</span></span>
<span id="cb8-105"><a href="#cb8-105" aria-hidden="true" tabindex="-1"></a>time <span class="ot"><-</span> <span class="fu">apply</span>(df4, <span class="dv">1</span>, min) <span class="co"># Time</span></span>
<span id="cb8-106"><a href="#cb8-106" aria-hidden="true" tabindex="-1"></a>time <span class="ot"><-</span> <span class="fu">data.frame</span>(time, <span class="at">stringsAsFactors =</span> <span class="cn">FALSE</span>)</span>
<span id="cb8-107"><a href="#cb8-107" aria-hidden="true" tabindex="-1"></a>time<span class="sc">$</span>iris <span class="ot"><-</span> <span class="fu">row.names</span>(time)</span>
<span id="cb8-108"><a href="#cb8-108" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> <span class="fu">merge</span>(osm_id, time, <span class="at">by =</span> <span class="st">"iris"</span>, <span class="at">all.x =</span> <span class="cn">TRUE</span>)</span>
<span id="cb8-109"><a href="#cb8-109" aria-hidden="true" tabindex="-1"></a>osm_id<span class="sc">$</span>geometry <span class="ot"><-</span> <span class="cn">NULL</span></span>
<span id="cb8-110"><a href="#cb8-110" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-111"><a href="#cb8-111" aria-hidden="true" tabindex="-1"></a><span class="co"># Number of climbing area at less than 15 minutes by bike</span></span>
<span id="cb8-112"><a href="#cb8-112" aria-hidden="true" tabindex="-1"></a>n15mn <span class="ot"><-</span> df4</span>
<span id="cb8-113"><a href="#cb8-113" aria-hidden="true" tabindex="-1"></a>n15mn <span class="ot"><-</span> <span class="fu">data.frame</span>(df4, <span class="at">stringsAsFactors =</span> <span class="cn">FALSE</span>)</span>
<span id="cb8-114"><a href="#cb8-114" aria-hidden="true" tabindex="-1"></a>n15mn[n15mn <span class="sc"><=</span> <span class="dv">15</span>] <span class="ot"><-</span> <span class="dv">1</span></span>
<span id="cb8-115"><a href="#cb8-115" aria-hidden="true" tabindex="-1"></a>n15mn[n15mn <span class="sc">></span> <span class="dv">15</span>] <span class="ot"><-</span> <span class="dv">0</span></span>
<span id="cb8-116"><a href="#cb8-116" aria-hidden="true" tabindex="-1"></a>n15mn<span class="sc">$</span>N <span class="ot"><-</span> <span class="fu">rowSums</span>(n15mn)</span>
<span id="cb8-117"><a href="#cb8-117" aria-hidden="true" tabindex="-1"></a>n15mn<span class="sc">$</span>iris <span class="ot"><-</span> <span class="fu">row.names</span>(n15mn)</span>
<span id="cb8-118"><a href="#cb8-118" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> <span class="fu">merge</span>(osm_id, n15mn[,<span class="fu">c</span>(<span class="st">"iris"</span>, <span class="st">"N"</span>)], <span class="at">by =</span> <span class="st">"iris"</span>,</span>
<span id="cb8-119"><a href="#cb8-119" aria-hidden="true" tabindex="-1"></a> <span class="at">all.x =</span> <span class="cn">TRUE</span>)</span>
<span id="cb8-120"><a href="#cb8-120" aria-hidden="true" tabindex="-1"></a>osm_id <span class="ot"><-</span> osm_id[,<span class="fu">c</span>(<span class="dv">1</span>,<span class="dv">3</span>,<span class="dv">5</span><span class="sc">:</span><span class="dv">6</span>)]</span>
<span id="cb8-121"><a href="#cb8-121" aria-hidden="true" tabindex="-1"></a><span class="fu">colnames</span>(osm_id) <span class="ot"><-</span> <span class="fu">c</span>(<span class="st">"CODE_IRIS"</span>, <span class="st">"FSGT_NAME"</span>, <span class="st">"FSGT_TIME"</span>,</span>
<span id="cb8-122"><a href="#cb8-122" aria-hidden="true" tabindex="-1"></a> <span class="st">"N_FSGT_15MN"</span>)</span>
<span id="cb8-123"><a href="#cb8-123" aria-hidden="true" tabindex="-1"></a>iris <span class="ot"><-</span> <span class="fu">merge</span>(iris, osm_id, <span class="at">by =</span> <span class="st">"CODE_IRIS"</span>, <span class="at">all.x =</span> <span class="cn">TRUE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
<section id="characterizing-the-poi-neighbourhood" class="level3">
<h3 class="anchored" data-anchor-id="characterizing-the-poi-neighbourhood">Characterizing the POI neighbourhood</h3>
<p>Then, the socio-economic neighbourhood of each climbing area is characterized.</p>
<p>The previous matrix is transposed (lines <> columns). For each climbing structure, the IRIS located at less than 15 minutes by bike is extracted to produce the following indicators :</p>
<ul>
<li><p>Total population at less than 15 minutes by bike. This can be considered as an amount of “local social demand”.</p></li>
<li><p>Minimum, mean and maximum of median income of IRIS at less than 15 minutes by bike.</p></li>
</ul>
<div class="cell">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb9"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="co"># 6. Characterise the POI neighbourhood ----</span></span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a>t.df <span class="ot"><-</span> <span class="fu">data.frame</span>(<span class="fu">t</span>(df))</span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a><span class="fu">colnames</span>(t.df) <span class="ot"><-</span> iris10k[iris10k<span class="sc">$</span>TYP_IRIS <span class="sc">==</span> <span class="st">"H"</span>,]<span class="sc">$</span>CODE_IRIS</span>
<span id="cb9-4"><a href="#cb9-4" aria-hidden="true" tabindex="-1"></a>t.df<span class="sc">$</span>osm_id <span class="ot"><-</span> dest<span class="sc">$</span>osm_id</span>
<span id="cb9-5"><a href="#cb9-5" aria-hidden="true" tabindex="-1"></a>t.df <span class="ot"><-</span> t.df[t.df<span class="sc">$</span>osm_id <span class="sc">%in%</span> poi<span class="sc">$</span>osm_id,]</span>
<span id="cb9-6"><a href="#cb9-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-7"><a href="#cb9-7" aria-hidden="true" tabindex="-1"></a>poi_socio <span class="ot"><-</span> <span class="fu">data.frame</span>(<span class="fu">matrix</span>(<span class="at">nrow =</span> <span class="dv">0</span>, <span class="at">ncol =</span> <span class="dv">5</span>))</span>
<span id="cb9-8"><a href="#cb9-8" aria-hidden="true" tabindex="-1"></a><span class="fu">colnames</span>(poi_socio) <span class="ot"><-</span> <span class="fu">c</span>(<span class="st">"osm_id"</span>, <span class="st">"SUM_POP18"</span>, <span class="st">"MIN_REV19"</span>, <span class="st">"MOY_REV19"</span>, <span class="st">"MAX_REV19"</span>)</span>
<span id="cb9-9"><a href="#cb9-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-10"><a href="#cb9-10" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> (i <span class="cf">in</span> <span class="dv">1</span><span class="sc">:</span><span class="fu">nrow</span>(t.df)){</span>
<span id="cb9-11"><a href="#cb9-11" aria-hidden="true" tabindex="-1"></a> tmp1 <span class="ot"><-</span> t.df[, t.df[i, ] <span class="sc"><</span> <span class="dv">15</span>]</span>
<span id="cb9-12"><a href="#cb9-12" aria-hidden="true" tabindex="-1"></a> tmp2 <span class="ot"><-</span> <span class="fu">data.frame</span>(<span class="at">CODE_IRIS =</span> <span class="fu">colnames</span>(tmp1))</span>
<span id="cb9-13"><a href="#cb9-13" aria-hidden="true" tabindex="-1"></a> tmp2 <span class="ot"><-</span> <span class="fu">merge</span>(tmp2, iris10k[,<span class="fu">c</span>(<span class="st">"CODE_IRIS"</span>, <span class="st">"P18_POP"</span>, <span class="st">"DISP_MED19"</span>)],</span>
<span id="cb9-14"><a href="#cb9-14" aria-hidden="true" tabindex="-1"></a> <span class="at">all.x =</span> <span class="cn">TRUE</span>)</span>
<span id="cb9-15"><a href="#cb9-15" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb9-16"><a href="#cb9-16" aria-hidden="true" tabindex="-1"></a> poi_socio[i,<span class="dv">1</span>] <span class="ot"><-</span> <span class="fu">row.names</span>(tmp1)[i]</span>
<span id="cb9-17"><a href="#cb9-17" aria-hidden="true" tabindex="-1"></a> poi_socio[i,<span class="dv">2</span>] <span class="ot"><-</span> <span class="fu">sum</span>(tmp2<span class="sc">$</span>P18_POP, <span class="at">na.rm =</span> <span class="cn">TRUE</span>)</span>
<span id="cb9-18"><a href="#cb9-18" aria-hidden="true" tabindex="-1"></a> poi_socio[i,<span class="dv">3</span>] <span class="ot"><-</span> <span class="fu">min</span>(tmp2<span class="sc">$</span>DISP_MED19, <span class="at">na.rm =</span> <span class="cn">TRUE</span>)</span>
<span id="cb9-19"><a href="#cb9-19" aria-hidden="true" tabindex="-1"></a> poi_socio[i,<span class="dv">4</span>] <span class="ot"><-</span> <span class="fu">mean</span>(tmp2<span class="sc">$</span>DISP_MED19, <span class="at">na.rm =</span> <span class="cn">TRUE</span>)</span>
<span id="cb9-20"><a href="#cb9-20" aria-hidden="true" tabindex="-1"></a> poi_socio[i,<span class="dv">5</span>] <span class="ot"><-</span> <span class="fu">max</span>(tmp2<span class="sc">$</span>DISP_MED19, <span class="at">na.rm =</span> <span class="cn">TRUE</span>)</span>
<span id="cb9-21"><a href="#cb9-21" aria-hidden="true" tabindex="-1"></a> }</span>
<span id="cb9-22"><a href="#cb9-22" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-23"><a href="#cb9-23" aria-hidden="true" tabindex="-1"></a>poi <span class="ot"><-</span> <span class="fu">merge</span>(poi, poi_socio, <span class="at">by =</span> <span class="st">"osm_id"</span>, <span class="at">all.x =</span> <span class="cn">TRUE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
<section id="output" class="level3">
<h3 class="anchored" data-anchor-id="output">Output</h3>
<p>Below is mapped one indicator calculated previously at IRIS level : time required to reach the nearest climbing area from the each populated IRIS centroid.</p>
<div class="cell">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb10"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(mapsf)</span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a><span class="co"># Create the map</span></span>
<span id="cb10-4"><a href="#cb10-4" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_init</span>(com, <span class="at">expandBB =</span> <span class="fu">c</span>(<span class="dv">0</span>,<span class="fl">0.4</span>,<span class="dv">0</span>,<span class="dv">0</span>), <span class="at">theme =</span> my_theme)</span>
<span id="cb10-5"><a href="#cb10-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb10-6"><a href="#cb10-6" aria-hidden="true" tabindex="-1"></a>cols <span class="ot"><-</span> <span class="fu">mf_get_pal</span>(<span class="at">n =</span> <span class="dv">10</span>, <span class="at">pal =</span> <span class="st">"RdYlGn"</span>, <span class="at">rev =</span> <span class="cn">TRUE</span>)</span>
<span id="cb10-7"><a href="#cb10-7" aria-hidden="true" tabindex="-1"></a>thr <span class="ot"><-</span> <span class="fu">c</span>(<span class="dv">0</span>, <span class="fl">2.5</span>, <span class="dv">5</span>, <span class="fl">7.5</span>, <span class="dv">10</span>, <span class="fl">12.5</span>, <span class="dv">15</span>, <span class="dv">20</span>, <span class="dv">25</span>, <span class="dv">30</span>, <span class="fu">max</span>(iris<span class="sc">$</span>ALL_TIME, <span class="at">na.rm =</span> <span class="cn">TRUE</span>))</span>
<span id="cb10-8"><a href="#cb10-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb10-9"><a href="#cb10-9" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_choro</span>(</span>
<span id="cb10-10"><a href="#cb10-10" aria-hidden="true" tabindex="-1"></a> <span class="at">x =</span> iris, <span class="at">var =</span> <span class="st">"ALL_TIME"</span>, </span>
<span id="cb10-11"><a href="#cb10-11" aria-hidden="true" tabindex="-1"></a> <span class="at">pal =</span> cols, <span class="at">lwd =</span> <span class="fl">0.25</span>, <span class="at">breaks =</span> thr, <span class="at">border =</span> <span class="st">"white"</span>,</span>
<span id="cb10-12"><a href="#cb10-12" aria-hidden="true" tabindex="-1"></a> <span class="at">leg_pos =</span> <span class="fu">c</span>(<span class="dv">631000</span>, <span class="dv">6872000</span>),</span>
<span id="cb10-13"><a href="#cb10-13" aria-hidden="true" tabindex="-1"></a> <span class="at">leg_title =</span> <span class="st">"Nearest climbing area</span><span class="sc">\n</span><span class="st">(all structures, minutes)"</span>, </span>
<span id="cb10-14"><a href="#cb10-14" aria-hidden="true" tabindex="-1"></a> <span class="at">col_na =</span> <span class="st">"lightgrey"</span>, <span class="at">leg_no_data =</span> <span class="st">"No dedicated to housing"</span>, <span class="at">add =</span> <span class="cn">TRUE</span>)</span>
<span id="cb10-15"><a href="#cb10-15" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb10-16"><a href="#cb10-16" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_map</span>(<span class="at">x =</span> poi, <span class="at">pch =</span> <span class="dv">21</span>, <span class="at">cex =</span> .<span class="dv">9</span>, <span class="at">bg =</span> <span class="st">"white"</span>, <span class="at">add =</span> <span class="cn">TRUE</span>)</span>
<span id="cb10-17"><a href="#cb10-17" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_map</span>(com, <span class="at">col =</span> <span class="cn">NA</span>, <span class="at">border =</span> <span class="st">"black"</span>, <span class="at">add =</span> <span class="cn">TRUE</span>)</span>
<span id="cb10-18"><a href="#cb10-18" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_label</span>(<span class="at">x =</span> poi, <span class="at">var =</span> <span class="st">"name"</span>, <span class="at">cex =</span> .<span class="dv">4</span>, <span class="at">halo =</span> <span class="cn">TRUE</span>, <span class="at">overlap =</span> <span class="cn">FALSE</span>, </span>
<span id="cb10-19"><a href="#cb10-19" aria-hidden="true" tabindex="-1"></a> <span class="at">bg =</span> <span class="st">"#ffffff80"</span>, <span class="at">pos =</span> <span class="dv">4</span>, <span class="at">add =</span> <span class="cn">TRUE</span>)</span>
<span id="cb10-20"><a href="#cb10-20" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb10-21"><a href="#cb10-21" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_title</span>(<span class="st">"Time to reach the nearest climbing area"</span>)</span>
<span id="cb10-22"><a href="#cb10-22" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_scale</span>(<span class="at">size =</span> <span class="dv">5</span>, <span class="at">col =</span> <span class="st">"black"</span>, <span class="at">pos =</span> <span class="st">"bottomright"</span>)</span>
<span id="cb10-23"><a href="#cb10-23" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_credits</span>(<span class="fu">paste0</span>(<span class="st">"Sources : © OpenStreetMap and Contributors, IGN, INSEE, 2022</span><span class="sc">\n</span><span class="st">"</span>,</span>
<span id="cb10-24"><a href="#cb10-24" aria-hidden="true" tabindex="-1"></a> <span class="st">"Realisation : Ronan Ysebaert, 2022"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<p><img src="index_files/figure-html/unnamed-chunk-11-1.png" class="img-fluid" style="width:100.0%"></p>
</div>
</div>
</section>
</section>
<section id="travel-time-isochrones" class="level2">
<h2 class="anchored" data-anchor-id="travel-time-isochrones">Travel time isochrones</h2>
<p>Moreover, we can be interested by defining the accessibility of climbing areas without taking into account any territorial division, which can introduce numerous bias, due to <a href="https://en.wikipedia.org/wiki/Modifiable_areal_unit_problem">MAUP</a> effects. This is done by building isochrones of equivalent time-distance coming from climbing areas, using the <code>mapiso</code> R package (<span class="citation" data-cites="mapiso">Giraud (<a href="#ref-mapiso" role="doc-biblioref">2022a</a>)</span>). Below are reminded the required steps to create polygons of equipotential from a regular grid of points :</p>
<ul>
<li>Create a regular grid (150m resolution in our case) and extract the centroids.</li>
<li>Compute travel time indicators with the <code>osrmtable</code> function of the <code>osrm</code> R package, from grid centroids to climbing areas.</li>
<li>Get the minimum value of the resulting matrix and join the result to the regular grid layer.</li>
<li>Create polygons with <code>mapiso</code> function, wich takes the resulting values included in the regular grid. The function takes the desired thresholds and the indicator we are interested in (which climbing area travel time).</li>
</ul>
<div class="cell">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb11"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="do">## 4.3 Isochrones from a regular grid to climbing areas ----</span></span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a><span class="co"># Compute travel time from grid to climbing areas</span></span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a><span class="co"># Create grid and extract centroids (cell size = 150 m)</span></span>
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a>mygrid <span class="ot"><-</span> <span class="fu">st_make_grid</span>(paris5k, <span class="at">cellsize =</span> <span class="dv">150</span>)</span>
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a>mygrid <span class="ot"><-</span> <span class="fu">st_centroid</span>(mygrid)</span>
<span id="cb11-6"><a href="#cb11-6" aria-hidden="true" tabindex="-1"></a>mygrid <span class="ot"><-</span> <span class="fu">st_sf</span>(<span class="at">ID =</span> <span class="dv">1</span><span class="sc">:</span><span class="fu">length</span>(mygrid), <span class="at">geometry =</span> mygrid)</span>
<span id="cb11-7"><a href="#cb11-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb11-8"><a href="#cb11-8" aria-hidden="true" tabindex="-1"></a>dest <span class="ot"><-</span> <span class="fu">st_transform</span>(dest, <span class="dv">2154</span>)</span>
<span id="cb11-9"><a href="#cb11-9" aria-hidden="true" tabindex="-1"></a>dest_priv <span class="ot"><-</span> dest[dest<span class="sc">$</span>type <span class="sc">==</span> <span class="st">"Speculative structure"</span>,] </span>
<span id="cb11-10"><a href="#cb11-10" aria-hidden="true" tabindex="-1"></a>dest_fsgt <span class="ot"><-</span> dest[dest<span class="sc">$</span>federation <span class="sc">==</span> <span class="st">"FSGT"</span>,]</span>
<span id="cb11-11"><a href="#cb11-11" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb11-12"><a href="#cb11-12" aria-hidden="true" tabindex="-1"></a><span class="co"># Compute travel time from grid centroids to all climbing areas</span></span>
<span id="cb11-13"><a href="#cb11-13" aria-hidden="true" tabindex="-1"></a>df5 <span class="ot"><-</span> <span class="fu">osrmTable</span>(<span class="at">src =</span> mygrid, <span class="at">dst =</span> dest, <span class="at">measure =</span> <span class="st">"duration"</span>)</span>
<span id="cb11-14"><a href="#cb11-14" aria-hidden="true" tabindex="-1"></a>df5 <span class="ot"><-</span> <span class="fu">data.frame</span>(df5<span class="sc">$</span>duration)</span>
<span id="cb11-15"><a href="#cb11-15" aria-hidden="true" tabindex="-1"></a><span class="fu">write.csv</span>(df5, <span class="st">"data-conso/grid-bike-duration.csv"</span>, <span class="at">row.names =</span> <span class="cn">FALSE</span>)</span>
<span id="cb11-16"><a href="#cb11-16" aria-hidden="true" tabindex="-1"></a>df5 <span class="ot"><-</span> <span class="fu">read.csv</span>(<span class="st">"data-conso/grid-bike-duration.csv"</span>)</span>
<span id="cb11-17"><a href="#cb11-17" aria-hidden="true" tabindex="-1"></a><span class="fu">colnames</span>(df5) <span class="ot"><-</span> <span class="fu">as.character</span>(dest<span class="sc">$</span>osm_id)</span>
<span id="cb11-18"><a href="#cb11-18" aria-hidden="true" tabindex="-1"></a>time <span class="ot"><-</span> <span class="fu">data.frame</span>(mygrid<span class="sc">$</span>ID, <span class="fu">apply</span>(df5, <span class="dv">1</span>, min)) <span class="co"># find minimum value</span></span>
<span id="cb11-19"><a href="#cb11-19" aria-hidden="true" tabindex="-1"></a><span class="fu">colnames</span>(time) <span class="ot"><-</span> <span class="fu">c</span>(<span class="st">"ID"</span>, <span class="st">"TIME_ALL"</span>)</span>
<span id="cb11-20"><a href="#cb11-20" aria-hidden="true" tabindex="-1"></a>mygrid <span class="ot"><-</span> <span class="fu">merge</span>(mygrid, time, <span class="at">by =</span> <span class="st">"ID"</span>, <span class="at">all.x =</span> <span class="cn">TRUE</span>) <span class="co"># merge time to grid</span></span>
<span id="cb11-21"><a href="#cb11-21" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb11-22"><a href="#cb11-22" aria-hidden="true" tabindex="-1"></a><span class="co"># Compute travel time from grid centroids to private climbing areas</span></span>
<span id="cb11-23"><a href="#cb11-23" aria-hidden="true" tabindex="-1"></a>df6 <span class="ot"><-</span> <span class="fu">osrmTable</span>(<span class="at">src =</span> mygrid, <span class="at">dst =</span> dest_priv, <span class="at">measure =</span> <span class="st">"duration"</span>)</span>
<span id="cb11-24"><a href="#cb11-24" aria-hidden="true" tabindex="-1"></a>df6 <span class="ot"><-</span> <span class="fu">data.frame</span>(df6<span class="sc">$</span>duration)</span>
<span id="cb11-25"><a href="#cb11-25" aria-hidden="true" tabindex="-1"></a><span class="fu">write.csv</span>(df6, <span class="st">"data-conso/grid-bike-duration_priv.csv"</span>, <span class="at">row.names =</span> <span class="cn">FALSE</span>)</span>
<span id="cb11-26"><a href="#cb11-26" aria-hidden="true" tabindex="-1"></a>df6 <span class="ot"><-</span> <span class="fu">read.csv</span>(<span class="st">"data-conso/grid-bike-duration_priv.csv"</span>)</span>
<span id="cb11-27"><a href="#cb11-27" aria-hidden="true" tabindex="-1"></a><span class="fu">colnames</span>(df6) <span class="ot"><-</span> <span class="fu">as.character</span>(dest_priv<span class="sc">$</span>osm_id)</span>
<span id="cb11-28"><a href="#cb11-28" aria-hidden="true" tabindex="-1"></a>time <span class="ot"><-</span> <span class="fu">data.frame</span>(mygrid<span class="sc">$</span>ID, <span class="fu">apply</span>(df6, <span class="dv">1</span>, min)) <span class="co"># find minimum value</span></span>
<span id="cb11-29"><a href="#cb11-29" aria-hidden="true" tabindex="-1"></a><span class="fu">colnames</span>(time) <span class="ot"><-</span> <span class="fu">c</span>(<span class="st">"ID"</span>, <span class="st">"TIME_PRIV"</span>)</span>
<span id="cb11-30"><a href="#cb11-30" aria-hidden="true" tabindex="-1"></a>mygrid <span class="ot"><-</span> <span class="fu">merge</span>(mygrid, time, <span class="at">by =</span> <span class="st">"ID"</span>, <span class="at">all.x =</span> <span class="cn">TRUE</span>) <span class="co"># merge time to grid</span></span>
<span id="cb11-31"><a href="#cb11-31" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb11-32"><a href="#cb11-32" aria-hidden="true" tabindex="-1"></a><span class="co"># Compute travel time from grid centroids to FSGT climbing areas</span></span>
<span id="cb11-33"><a href="#cb11-33" aria-hidden="true" tabindex="-1"></a>df7 <span class="ot"><-</span> <span class="fu">osrmTable</span>(<span class="at">src =</span> mygrid, <span class="at">dst =</span> dest_fsgt, <span class="at">measure =</span> <span class="st">"duration"</span>)</span>
<span id="cb11-34"><a href="#cb11-34" aria-hidden="true" tabindex="-1"></a>df7 <span class="ot"><-</span> <span class="fu">data.frame</span>(df7<span class="sc">$</span>duration)</span>
<span id="cb11-35"><a href="#cb11-35" aria-hidden="true" tabindex="-1"></a><span class="fu">write.csv</span>(df7, <span class="st">"data-conso/grid-bike-duration_fsgt.csv"</span>, <span class="at">row.names =</span> <span class="cn">FALSE</span>)</span>
<span id="cb11-36"><a href="#cb11-36" aria-hidden="true" tabindex="-1"></a>df7 <span class="ot"><-</span> <span class="fu">read.csv</span>(<span class="st">"data-conso/grid-bike-duration_fsgt.csv"</span>)</span>
<span id="cb11-37"><a href="#cb11-37" aria-hidden="true" tabindex="-1"></a><span class="fu">colnames</span>(df7) <span class="ot"><-</span> <span class="fu">as.character</span>(dest_fsgt<span class="sc">$</span>osm_id)</span>
<span id="cb11-38"><a href="#cb11-38" aria-hidden="true" tabindex="-1"></a>time <span class="ot"><-</span> <span class="fu">data.frame</span>(mygrid<span class="sc">$</span>ID, <span class="fu">apply</span>(df7, <span class="dv">1</span>, min)) <span class="co"># find minimum value</span></span>
<span id="cb11-39"><a href="#cb11-39" aria-hidden="true" tabindex="-1"></a><span class="fu">colnames</span>(time) <span class="ot"><-</span> <span class="fu">c</span>(<span class="st">"ID"</span>, <span class="st">"TIME_FSGT"</span>)</span>
<span id="cb11-40"><a href="#cb11-40" aria-hidden="true" tabindex="-1"></a>mygrid <span class="ot"><-</span> <span class="fu">merge</span>(mygrid, time, <span class="at">by =</span> <span class="st">"ID"</span>, <span class="at">all.x =</span> <span class="cn">TRUE</span>) <span class="co"># merge time to grid</span></span>
<span id="cb11-41"><a href="#cb11-41" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb11-42"><a href="#cb11-42" aria-hidden="true" tabindex="-1"></a><span class="co"># Compute isochrones</span></span>
<span id="cb11-43"><a href="#cb11-43" aria-hidden="true" tabindex="-1"></a><span class="co"># define breaks (based on quantile analysis)</span></span>
<span id="cb11-44"><a href="#cb11-44" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(mapiso)</span>
<span id="cb11-45"><a href="#cb11-45" aria-hidden="true" tabindex="-1"></a>thr <span class="ot"><-</span> <span class="fu">c</span>(<span class="dv">0</span>, <span class="fl">2.5</span>, <span class="dv">5</span>, <span class="fl">7.5</span>, <span class="dv">10</span>, <span class="fl">12.5</span>, <span class="dv">15</span>, <span class="dv">20</span>, <span class="dv">25</span>, <span class="dv">30</span>, <span class="fu">max</span>(mygrid<span class="sc">$</span>TIME_FSGT))</span>
<span id="cb11-46"><a href="#cb11-46" aria-hidden="true" tabindex="-1"></a>iso_all <span class="ot"><-</span> <span class="fu">mapiso</span>(<span class="at">x =</span> mygrid, <span class="at">var =</span> <span class="st">"TIME_ALL"</span>, <span class="at">breaks =</span> thr, <span class="at">mask =</span> paris5k)</span>
<span id="cb11-47"><a href="#cb11-47" aria-hidden="true" tabindex="-1"></a>iso_fsgt <span class="ot"><-</span> <span class="fu">mapiso</span>(<span class="at">x =</span> mygrid, <span class="at">var =</span> <span class="st">"TIME_FSGT"</span>, <span class="at">breaks =</span> thr, <span class="at">mask =</span> paris5k)</span>
<span id="cb11-48"><a href="#cb11-48" aria-hidden="true" tabindex="-1"></a>iso_priv <span class="ot"><-</span> <span class="fu">mapiso</span>(<span class="at">x =</span> mygrid, <span class="at">var =</span> <span class="st">"TIME_PRIV"</span>, <span class="at">breaks =</span> thr, <span class="at">mask =</span> paris5k)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
<section id="output-1" class="level3">
<h3 class="anchored" data-anchor-id="output-1">Output</h3>
<p>The maps below display the location of the climbing areas in the study area (white dots), the travel-time by bike required to reach each points from the 150m regular grid (dot map) and the resulting isochrones deducted from these values.</p>
<div class="cell">
</div>
<div class="cell">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb12"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="co"># thresholds, colours and background colours</span></span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a>thr <span class="ot"><-</span> <span class="fu">c</span>(<span class="dv">0</span>, <span class="fl">2.5</span>, <span class="dv">5</span>, <span class="fl">7.5</span>, <span class="dv">10</span>, <span class="fl">12.5</span>, <span class="dv">15</span>, <span class="dv">20</span>, <span class="dv">25</span>, <span class="dv">30</span>, <span class="fu">max</span>(mygrid<span class="sc">$</span>TIME_ALL))</span>
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true" tabindex="-1"></a><span class="co"># Map input grid</span></span>
<span id="cb12-5"><a href="#cb12-5" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_init</span>(com, <span class="at">expandBB =</span> <span class="fu">c</span>(<span class="dv">0</span>,<span class="fl">0.4</span>,<span class="dv">0</span>,<span class="dv">0</span>), <span class="at">theme =</span> my_theme)</span>
<span id="cb12-6"><a href="#cb12-6" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_map</span>(mygrid, <span class="at">var =</span> <span class="st">"TIME_ALL"</span>, <span class="at">pch =</span> <span class="dv">21</span>, <span class="at">cex =</span> .<span class="dv">4</span>, <span class="at">border =</span> <span class="cn">NA</span>,</span>
<span id="cb12-7"><a href="#cb12-7" aria-hidden="true" tabindex="-1"></a> <span class="at">type =</span> <span class="st">"choro"</span>, <span class="at">breaks =</span> thr, <span class="at">pal =</span> cols, <span class="at">leg_pos =</span> <span class="fu">c</span>(<span class="dv">631000</span>, <span class="dv">6872000</span>), </span>
<span id="cb12-8"><a href="#cb12-8" aria-hidden="true" tabindex="-1"></a> <span class="at">leg_title =</span> <span class="st">"Time to reach</span><span class="sc">\n</span><span class="st">the nearest climbing area</span><span class="sc">\n</span><span class="st">from a 150m regular</span><span class="sc">\n</span><span class="st">grid centroids"</span>,</span>
<span id="cb12-9"><a href="#cb12-9" aria-hidden="true" tabindex="-1"></a> <span class="at">add =</span> <span class="cn">TRUE</span>) </span>
<span id="cb12-10"><a href="#cb12-10" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_map</span>(poi, <span class="at">pch =</span> <span class="dv">21</span>, <span class="at">add =</span> <span class="cn">TRUE</span>)</span>
<span id="cb12-11"><a href="#cb12-11" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_title</span>(<span class="st">"Isochrones input : travel time from a 150 m regular grid"</span>)</span>
<span id="cb12-12"><a href="#cb12-12" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_scale</span>(<span class="at">size =</span> <span class="dv">5</span>, <span class="at">col =</span> <span class="st">"black"</span>, <span class="at">pos =</span> <span class="st">"bottomright"</span>)</span>
<span id="cb12-13"><a href="#cb12-13" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_credits</span>(<span class="fu">paste0</span>(<span class="st">"Sources : © OpenStreetMap and Contributors, 2022</span><span class="sc">\n</span><span class="st">"</span>,</span>
<span id="cb12-14"><a href="#cb12-14" aria-hidden="true" tabindex="-1"></a> <span class="st">"Realisation : Ronan Ysebaert, 2022"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<p><img src="index_files/figure-html/unnamed-chunk-14-1.png" class="img-fluid" style="width:100.0%"></p>
</div>
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb13"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Map resulting isochrones</span></span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_init</span>(com, <span class="at">expandBB =</span> <span class="fu">c</span>(<span class="dv">0</span>,<span class="fl">0.4</span>,<span class="dv">0</span>,<span class="dv">0</span>), <span class="at">theme =</span> my_theme)</span>
<span id="cb13-3"><a href="#cb13-3" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_map</span>(iso_all, <span class="at">var =</span> <span class="st">"isomin"</span>, <span class="at">type =</span> <span class="st">"choro"</span>, <span class="at">breaks =</span> thr, <span class="at">pal =</span> cols, </span>
<span id="cb13-4"><a href="#cb13-4" aria-hidden="true" tabindex="-1"></a> <span class="at">border =</span> <span class="cn">NA</span>, <span class="at">leg_pos =</span> <span class="fu">c</span>(<span class="dv">631000</span>, <span class="dv">6872000</span>), </span>
<span id="cb13-5"><a href="#cb13-5" aria-hidden="true" tabindex="-1"></a> <span class="at">leg_title =</span> <span class="st">"Time to reach</span><span class="sc">\n</span><span class="st">the nearest climbing area</span><span class="sc">\n</span><span class="st">by bike"</span>,</span>
<span id="cb13-6"><a href="#cb13-6" aria-hidden="true" tabindex="-1"></a> <span class="at">add =</span> <span class="cn">TRUE</span>)</span>
<span id="cb13-7"><a href="#cb13-7" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_map</span>(com, <span class="at">col =</span> <span class="cn">NA</span>, <span class="at">add =</span> <span class="cn">TRUE</span>)</span>
<span id="cb13-8"><a href="#cb13-8" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_map</span>(poi, <span class="at">pch =</span> <span class="dv">21</span>, <span class="at">add =</span> <span class="cn">TRUE</span>)</span>
<span id="cb13-9"><a href="#cb13-9" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_title</span>(<span class="st">"Isochrones output : transformation of regularly spaced grids into contour polygons"</span>)</span>
<span id="cb13-10"><a href="#cb13-10" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_scale</span>(<span class="at">size =</span> <span class="dv">5</span>, <span class="at">col =</span> <span class="st">"black"</span>, <span class="at">pos =</span> <span class="st">"bottomright"</span>)</span>
<span id="cb13-11"><a href="#cb13-11" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_credits</span>(<span class="fu">paste0</span>(<span class="st">"Sources : © OpenStreetMap and Contributors, IGN, 2022</span><span class="sc">\n</span><span class="st">"</span>,</span>
<span id="cb13-12"><a href="#cb13-12" aria-hidden="true" tabindex="-1"></a> <span class="st">"Realisation : Ronan Ysebaert, 2022"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<p><img src="index_files/figure-html/unnamed-chunk-14-2.png" class="img-fluid" style="width:100.0%"></p>
</div>
</div>
</section>
</section>
<section id="osrm-climbing-trip" class="level2">
<h2 class="anchored" data-anchor-id="osrm-climbing-trip">OSRM climbing trip</h2>
<div class="cell">
</div>
<p><code>osrmTrip</code> is a function from the <code>osrm</code> package (<span class="citation" data-cites="osrm">Giraud (<a href="#ref-osrm" role="doc-biblioref">2022b</a>)</span>) which allows to get the travel geometry between multiple unordered points. The output is a sf LINESTRING with 2 components : duration (in minutes) and distance (in kilometres).</p>
<p>This function is applied to the climbing areas held by the FSGT federation.</p>
<div class="cell">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb14"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a>dest_fsgt <span class="ot"><-</span> <span class="fu">st_transform</span>(dest_fsgt, <span class="dv">2154</span>)</span>
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true" tabindex="-1"></a>dest_fsgt <span class="ot"><-</span> <span class="fu">st_intersection</span>(dest_fsgt, paris_5k)</span>
<span id="cb14-3"><a href="#cb14-3" aria-hidden="true" tabindex="-1"></a>dest_fsgt <span class="ot"><-</span> <span class="fu">st_transform</span>(dest_fsgt, <span class="dv">4326</span>)</span>
<span id="cb14-4"><a href="#cb14-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb14-5"><a href="#cb14-5" aria-hidden="true" tabindex="-1"></a>trip <span class="ot"><-</span> <span class="fu">osrmTrip</span>(<span class="at">loc =</span> dest_fsgt)</span>
<span id="cb14-6"><a href="#cb14-6" aria-hidden="true" tabindex="-1"></a>trip <span class="ot"><-</span> trip[[<span class="dv">1</span>]]<span class="sc">$</span>trip</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
<p>To reach the 22 climbing areas of the FSGT federation located in the study area, the osrmTrip function returns that the fastest cycling trip around these climbing areas can be done in 420.93 minutes and 88.3846 kilometres.</p>
<div class="cell">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb15"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(maptiles)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: le package 'maptiles' a été compilé avec la version R 4.2.1</code></pre>
</div>
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb17"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a>osm <span class="ot"><-</span> <span class="fu">get_tiles</span>(<span class="at">x =</span> trip, <span class="at">crop =</span> <span class="cn">TRUE</span>, <span class="at">zoom =</span> <span class="dv">13</span>)</span>
<span id="cb17-2"><a href="#cb17-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb17-3"><a href="#cb17-3" aria-hidden="true" tabindex="-1"></a>theme <span class="ot"><-</span> <span class="fu">mf_theme</span>(<span class="at">mar =</span> <span class="fu">c</span>(<span class="dv">0</span>,<span class="dv">0</span>,<span class="fl">1.2</span>,<span class="dv">0</span>), <span class="at">inner =</span> <span class="cn">FALSE</span>, <span class="at">line =</span> <span class="fl">1.2</span>, <span class="at">cex =</span> .<span class="dv">9</span>, </span>
<span id="cb17-4"><a href="#cb17-4" aria-hidden="true" tabindex="-1"></a> <span class="at">pos =</span> <span class="st">"center"</span>, <span class="at">tab =</span> <span class="cn">FALSE</span>)</span>
<span id="cb17-5"><a href="#cb17-5" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_raster</span>(osm)</span>
<span id="cb17-6"><a href="#cb17-6" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_map</span>(trip, <span class="at">lwd =</span> <span class="dv">4</span>, <span class="at">add =</span> <span class="cn">TRUE</span>, <span class="at">col =</span> <span class="st">"blue"</span>)</span>
<span id="cb17-7"><a href="#cb17-7" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_map</span>(trip, <span class="at">lwd =</span> <span class="dv">1</span>, <span class="at">col =</span> <span class="st">"white"</span>, <span class="at">add =</span> <span class="cn">TRUE</span>)</span>
<span id="cb17-8"><a href="#cb17-8" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_map</span>(dest_fsgt, <span class="at">pch =</span> <span class="dv">20</span>, <span class="at">col =</span> <span class="st">"red"</span>, <span class="at">add =</span> <span class="cn">TRUE</span>)</span>
<span id="cb17-9"><a href="#cb17-9" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_title</span>(<span class="st">"Fastest cycling trip to reach all FSGT climbing areas"</span>)</span>
<span id="cb17-10"><a href="#cb17-10" aria-hidden="true" tabindex="-1"></a><span class="fu">mf_credits</span>(<span class="fu">get_credit</span>(<span class="st">"OpenStreetMap"</span>), <span class="at">pos =</span> <span class="st">"bottomright"</span>, </span>
<span id="cb17-11"><a href="#cb17-11" aria-hidden="true" tabindex="-1"></a> <span class="at">bg =</span> <span class="st">"#ffffff80"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<p><img src="index_files/figure-html/unnamed-chunk-17-1.png" class="img-fluid" style="width:100.0%"></p>
</div>
</div>
<section id="manual-corrections-out-of-osm" class="level3">
<h3 class="anchored" data-anchor-id="manual-corrections-out-of-osm">Manual corrections (out of OSM)</h3>
<p>I noticed that in the OpenStreetMap database some attributes could be specified more precisely. However, my use does not correspond to the one recommended by OSM : climbing_length is not climbing_max. Moreover, this attribute has been set directly in OSM by the private brand.</p>
<p>Consequently, I prefer not to change these attributes in the OSM database, but directly in my R programme.</p>
<div class="cell">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb18"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Correct MurMur and Rename ESC15</span></span>
<span id="cb18-2"><a href="#cb18-2" aria-hidden="true" tabindex="-1"></a>poi[<span class="dv">17</span>,<span class="st">"climbing_length"</span>] <span class="ot"><-</span> <span class="dv">17</span></span>
<span id="cb18-3"><a href="#cb18-3" aria-hidden="true" tabindex="-1"></a>poi[<span class="dv">16</span>,<span class="st">"name"</span>] <span class="ot"><-</span> <span class="st">"ESC 15 - La Plaine"</span></span>
<span id="cb18-4"><a href="#cb18-4" aria-hidden="true" tabindex="-1"></a>poi[<span class="dv">31</span>,<span class="st">"name"</span>] <span class="ot"><-</span> <span class="st">"ESC 15 - Croix Nivert"</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
</section>
<section id="simplify-geometries" class="level2">
<h2 class="anchored" data-anchor-id="simplify-geometries">Simplify geometries</h2>
<p>Geometries are quite detailed. The library <code>rmapshaper</code> (<span class="citation" data-cites="rmapshaper">Andy Teucher (<a href="#ref-rmapshaper" role="doc-biblioref">2022</a>)</span>) is used to simplify the layer. 9 % of the points constituting the polygons are kept. Then, the IRIS layer is aggregated in communes for the map layout.</p>
<p>We also extract the IRIS located at less than 15 minutes from a artificial climbing area for some upcoming maps.</p>
<div class="cell">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb19"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(rmapshaper)</span>
<span id="cb19-2"><a href="#cb19-2" aria-hidden="true" tabindex="-1"></a>iris <span class="ot"><-</span> <span class="fu">ms_simplify</span>(iris, <span class="at">keep =</span> <span class="fl">0.09</span>)</span>
<span id="cb19-3"><a href="#cb19-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb19-4"><a href="#cb19-4" aria-hidden="true" tabindex="-1"></a><span class="co"># Communes aggregation (layout)</span></span>
<span id="cb19-5"><a href="#cb19-5" aria-hidden="true" tabindex="-1"></a>com <span class="ot"><-</span> <span class="fu">aggregate</span>(iris[,<span class="fu">c</span>(<span class="st">"INSEE_COM"</span>, <span class="st">"NOM_COM"</span>)],</span>
<span id="cb19-6"><a href="#cb19-6" aria-hidden="true" tabindex="-1"></a> <span class="at">by =</span> <span class="fu">list</span>(iris<span class="sc">$</span>INSEE_COM),</span>
<span id="cb19-7"><a href="#cb19-7" aria-hidden="true" tabindex="-1"></a> <span class="at">FUN =</span> head, <span class="dv">1</span>)</span>
<span id="cb19-8"><a href="#cb19-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb19-9"><a href="#cb19-9" aria-hidden="true" tabindex="-1"></a><span class="co"># Extract IRIS at less than 15 minutes by bike</span></span>
<span id="cb19-10"><a href="#cb19-10" aria-hidden="true" tabindex="-1"></a>iris15 <span class="ot"><-</span> iris[iris<span class="sc">$</span>ALL_TIME <span class="sc"><</span> <span class="dv">15</span>,]</span>
<span id="cb19-11"><a href="#cb19-11" aria-hidden="true" tabindex="-1"></a>iris15 <span class="ot"><-</span> iris15[<span class="sc">!</span><span class="fu">is.na</span>(iris15<span class="sc">$</span>ALL_TIME),]</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
<section id="export-results" class="level2">
<h2 class="anchored" data-anchor-id="export-results">Export results</h2>
<p>Data preparation is over. Resulting <code>sf</code> objects that will be used for data visualizations are exported in geojson files in the <a href="https://github.com/rysebaert/climbing_paris/tree/main/data-conso">data-conso</a> folder.</p>
<div class="cell">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb20"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb20-1"><a href="#cb20-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Export IRIS, POI, com layers</span></span>
<span id="cb20-2"><a href="#cb20-2" aria-hidden="true" tabindex="-1"></a><span class="fu">st_write</span>(com, <span class="st">"data-conso/com.geojson"</span>)</span>
<span id="cb20-3"><a href="#cb20-3" aria-hidden="true" tabindex="-1"></a><span class="fu">st_write</span>(iris, <span class="st">"data-conso/iris.geojson"</span>)</span>
<span id="cb20-4"><a href="#cb20-4" aria-hidden="true" tabindex="-1"></a><span class="fu">st_write</span>(poi, <span class="st">"data-conso/poi.geojson"</span>)</span>
<span id="cb20-5"><a href="#cb20-5" aria-hidden="true" tabindex="-1"></a><span class="fu">st_write</span>(iris15, <span class="st">"data-conso/iris15.geojson"</span>)</span>
<span id="cb20-6"><a href="#cb20-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb20-7"><a href="#cb20-7" aria-hidden="true" tabindex="-1"></a><span class="co"># Export material related to isochrones</span></span>
<span id="cb20-8"><a href="#cb20-8" aria-hidden="true" tabindex="-1"></a>mygrid <span class="ot"><-</span> <span class="fu">st_transform</span>(mygrid, <span class="dv">4326</span>)</span>
<span id="cb20-9"><a href="#cb20-9" aria-hidden="true" tabindex="-1"></a>iso_all <span class="ot"><-</span> <span class="fu">st_transform</span>(iso_all, <span class="dv">4326</span>)</span>
<span id="cb20-10"><a href="#cb20-10" aria-hidden="true" tabindex="-1"></a>iso_fsgt <span class="ot"><-</span> <span class="fu">st_transform</span>(iso_fsgt, <span class="dv">4326</span>)</span>
<span id="cb20-11"><a href="#cb20-11" aria-hidden="true" tabindex="-1"></a>iso_priv <span class="ot"><-</span> <span class="fu">st_transform</span>(iso_priv, <span class="dv">4326</span>)</span>
<span id="cb20-12"><a href="#cb20-12" aria-hidden="true" tabindex="-1"></a><span class="fu">st_write</span>(mygrid, <span class="st">"data-conso/mygrid.geojson"</span>)</span>
<span id="cb20-13"><a href="#cb20-13" aria-hidden="true" tabindex="-1"></a><span class="fu">st_write</span>(iso_all, <span class="st">"data-conso/iso_all.geojson"</span>)</span>
<span id="cb20-14"><a href="#cb20-14" aria-hidden="true" tabindex="-1"></a><span class="fu">st_write</span>(iso_fsgt, <span class="st">"data-conso/iso_fsgt.geojson"</span>)</span>
<span id="cb20-15"><a href="#cb20-15" aria-hidden="true" tabindex="-1"></a><span class="fu">st_write</span>(iso_priv, <span class="st">"data-conso/iso_priv.geojson"</span>)</span>
<span id="cb20-16"><a href="#cb20-16" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb20-17"><a href="#cb20-17" aria-hidden="true" tabindex="-1"></a><span class="co"># Export material related to travel-trip</span></span>
<span id="cb20-18"><a href="#cb20-18" aria-hidden="true" tabindex="-1"></a><span class="fu">st_write</span>(trip, <span class="st">"data-conso/trip.geojson"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
<section id="session-info-r" class="level2">
<h2 class="anchored" data-anchor-id="session-info-r">Session info (R)</h2>
<div class="cell">
<div class="cell-output cell-output-stderr">
<pre><code>Warning: le package 'osmdata' a été compilé avec la version R 4.2.1</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: le package 'readxl' a été compilé avec la version R 4.2.1</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=French_France.utf8 LC_CTYPE=French_France.utf8
[3] LC_MONETARY=French_France.utf8 LC_NUMERIC=C
[5] LC_TIME=French_France.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] readxl_1.4.1 rmapshaper_0.4.6 osrm_4.0.0.0 osmdata_0.1.10
[5] maptiles_0.3.0 mapsf_0.5.0 sf_1.0-8
loaded via a namespace (and not attached):
[1] tidyselect_1.1.2 terra_1.6-7 xfun_0.32 purrr_0.3.4
[5] lattice_0.20-45 V8_4.2.1 vctrs_0.4.1 generics_0.1.3
[9] htmltools_0.5.3 yaml_2.3.5 utf8_1.2.2 rlang_1.0.4
[13] geojsonlint_0.4.0 e1071_1.7-11 pillar_1.8.1 glue_1.6.2
[17] httpcode_0.3.0 DBI_1.1.3 slippymath_0.3.1 sp_1.5-0
[21] lifecycle_1.0.1 stringr_1.4.1 cellranger_1.1.0 htmlwidgets_1.5.4
[25] codetools_0.2-18 evaluate_0.16 knitr_1.40 fastmap_1.1.0
[29] curl_4.3.2 class_7.3-20 fansi_1.0.3 Rcpp_1.0.9
[33] KernSmooth_2.23-20 classInt_0.4-7 jsonvalidate_1.3.2 jsonlite_1.8.0
[37] png_0.1-7 digest_0.6.29 stringi_1.7.8 dplyr_1.0.9
[41] grid_4.2.0 cli_3.3.0 tools_4.2.0 magrittr_2.0.3
[45] proxy_0.4-27 tibble_3.1.8 crul_1.2.0 pkgconfig_2.0.3
[49] assertthat_0.2.1 rmarkdown_2.16 rstudioapi_0.14 R6_2.5.1
[53] units_0.8-0 compiler_4.2.0 </code></pre>
</div>
</div>
</section>
</section>
<section id="data-visualization-with-observable-javascript-ojs" class="level1">
<h1>Data visualization with Observable JavaScript (ojs)</h1>
<p>Observable is a startup founded by Mike Bostock and Melody Mechfessel, who initiated an on-line platform to collaboratively explore, analyse, visualize and communicate with data on the Web.</p>
<p>The computing language is <a href="https://observablehq.com/@observablehq/observables-not-javascript">Observable JavaScript (ojs)</a>. It is possible to include this programming language in Quarto chunks.</p>
<p>This section imports some visualizations realized in an <a href="https://observablehq.com/collection/@rysebaert/climbing_paris">Observable collection</a>. Have a look to this resource to see the overall project !</p>
<p>All the maps produced below use the bertin.js library (<span class="citation" data-cites="bertin">Lambert (<a href="#ref-bertin" role="doc-biblioref">2023a</a>)</span>). Have a look to the documentation in this <a href="https://www.npmjs.com/package/bertin">npm repository</a> or in this <a href="https://observablehq.com/collection/@neocartocnrs/bertin">Observable Collection</a> to see the possibilities offered by this library to the map creator !</p>
<section id="import-consolidated-data" class="level2">
<h2 class="anchored" data-anchor-id="import-consolidated-data">Import consolidated data</h2>
<p>Geojson files coming from the data preparation precessing realized in a R programming language and described above are imported.</p>
<div class="cell">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb24" data-startfrom="750" data-source-offset="-0"><pre class="sourceCode js code-with-copy"><code class="sourceCode javascript" style="counter-reset: source-line 749;"><span id="cb24-750"><a href="#cb24-750" aria-hidden="true" tabindex="-1"></a>iris <span class="op">=</span> <span class="fu">FileAttachment</span>(<span class="st">"data-conso/iris.geojson"</span>)<span class="op">.</span><span class="fu">json</span>()</span>
<span id="cb24-751"><a href="#cb24-751" aria-hidden="true" tabindex="-1"></a>poi <span class="op">=</span> <span class="fu">FileAttachment</span>(<span class="st">"data-conso/poi.geojson"</span>)<span class="op">.</span><span class="fu">json</span>()</span>
<span id="cb24-752"><a href="#cb24-752" aria-hidden="true" tabindex="-1"></a>com <span class="op">=</span> <span class="fu">FileAttachment</span>(<span class="st">"data-conso/com.geojson"</span>)<span class="op">.</span><span class="fu">json</span>()</span>
<span id="cb24-753"><a href="#cb24-753" aria-hidden="true" tabindex="-1"></a>iris15 <span class="op">=</span> <span class="fu">FileAttachment</span>(<span class="st">"data-conso/iris15.geojson"</span>)<span class="op">.</span><span class="fu">json</span>()</span>
<span id="cb24-754"><a href="#cb24-754" aria-hidden="true" tabindex="-1"></a>iso_all <span class="op">=</span> <span class="fu">FileAttachment</span>(<span class="st">"data-conso/iso_all.geojson"</span>)<span class="op">.</span><span class="fu">json</span>()</span>
<span id="cb24-755"><a href="#cb24-755" aria-hidden="true" tabindex="-1"></a>iso_priv <span class="op">=</span> <span class="fu">FileAttachment</span>(<span class="st">"data-conso/iso_priv.geojson"</span>)<span class="op">.</span><span class="fu">json</span>()</span>
<span id="cb24-756"><a href="#cb24-756" aria-hidden="true" tabindex="-1"></a>iso_fsgt <span class="op">=</span> <span class="fu">FileAttachment</span>(<span class="st">"data-conso/iso_fsgt.geojson"</span>)<span class="op">.</span><span class="fu">json</span>()</span>
<span id="cb24-757"><a href="#cb24-757" aria-hidden="true" tabindex="-1"></a>trip <span class="op">=</span> <span class="fu">FileAttachment</span>(<span class="st">"data-conso/trip.geojson"</span>)<span class="op">.</span><span class="fu">json</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-display">
<div>
<div id="ojs-cell-1-1" data-nodetype="declaration">
</div>
</div>
</div>
<div class="cell-output cell-output-display">
<div>
<div id="ojs-cell-1-2" data-nodetype="declaration">
</div>
</div>
</div>
<div class="cell-output cell-output-display">
<div>
<div id="ojs-cell-1-3" data-nodetype="declaration">
</div>
</div>
</div>
<div class="cell-output cell-output-display">
<div>
<div id="ojs-cell-1-4" data-nodetype="declaration">
</div>
</div>