-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.qmd
1803 lines (1488 loc) · 68.8 KB
/
index.qmd
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
---
title: "Travel time calculation with R and data visualization with Observable"
subtitle: "Application to artifical climbing walls in Paris and its neighbourhood"
author:
- name: Ronan Ysebaert
url: https://rysebaert.github.io/climbing_paris/
affiliation: UAR RIATE, Université Paris Cité, CNRS
affiliation-url: https://riate.cnrs.fr/
citation: true
date: "`r Sys.Date()`"
bibliography: bib.bib
format:
html:
theme: sandstone
fontsize: 0.9em
code-tools: true
code-fold: true
toc: true
toc-depth: 2
css: "styles.css"
linkcolor: "#8631ad"
---
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).
The graphical outputs displayed in this notebook are further developed in an [Observable collection](https://observablehq.com/collection/@rysebaert/climbing_paris "Go to Observable Notebook"). To introduce the reader to the issues raised by indoor sport-climbing in Paris, have a look to [this notebook](https://observablehq.com/d/d2be39c4dd55a32d?collection=@rysebaert/climbing_paris "Go to Observable Notebook").
This Quarto document combines 2 programming languages : R for data processing, and ObservableJS for data visualizations.
# Data processing with R
The entire R script can be found [here](https://github.com/rysebaert/climbing_paris/blob/main/script.R). Geojson files resulting from the data processing are available in the [data-conso](https://github.com/rysebaert/climbing_paris/tree/main/data-conso) folder of the github repository of the project. These files are directly imported in Observable notebooks for data visualization.
## Data sources
Three data sources, coming from three data providers, will be used:
- **IGN** : [The Contour...IRIS® édition 2020](https://geoservices.ign.fr/contoursiris "Access to input geometries (France)"), which corresponds to the lowest territorial division in France (below the communes level).
- **INSEE** : for socio-economic indicators (IRIS [Median income](https://www.insee.fr/fr/statistiques/6049648 "Go to input data") and [population](https://www.insee.fr/fr/statistiques/5650720?sommaire=4658626 "Go to input data") in 2019).
- **OpenStreetMap** : download of Point Of Interest (POI) and travel time calculation by bike between IRIS centroids and POI, using the [OSRM routing engine](http://project-osrm.org/ "Access to OSRM Website").
Input data is not provided in the [GitHub repository](https://github.com/rysebaert/climbing_paris) (too large files), but can easily be downloaded and used (no constraints of use).
## Map layout
A bounding box of 5 km around Paris, without *Bois de Boulogne* and *Bois de Vincennes* for a better centering of the map layout around Paris is created.
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.
```{r, eval = FALSE}
# 1. Map layout preparation at IRIS scale (source IGN)----
library(sf)
iris <- st_read("data-raw/CONTOURS-IRIS.shp", quiet = TRUE)
# Extract Paris and delete
# Bois-de-Vincennes / Boulogne Iris for map template
iris$dep <- substr(iris$INSEE_COM, 1, 2)
paris <- iris[iris$dep == "75",]
paris <- paris[!paris$NOM_IRIS %in% c("Bois de Vincennes 1",
"Bois de Vincennes 2",
"Bois de Boulogne 1",
"Bois de Boulogne 2",
"Bois de Boulogne 3"),]
paris <- st_union(paris)
# 5 km around Paris map layout
paris5k <- st_buffer(paris, 5000)
paris5k <- st_as_sfc(st_bbox(paris5k, crs = 2154))
paris <- paris5k
# 10 km around Paris (get OSM data) in long/lat
paris10k <- st_buffer(paris, 10000)
paris10k <- st_as_sfc(st_bbox(paris10k, crs = 2154))
# Intersection with IRIS
iris10k <- st_intersection(iris, paris10k)
# Bounding box for osm extract
paris10k <- st_transform(paris10k, 4326)
paris10k <- st_bbox(paris10k)
paris10k <- as.vector(paris10k)
```
## Feed IRIS with socio-economic data (INSEE)
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.
```{r, eval = FALSE}
# 2. Feed IRIS layer by socio-economic data (INSEE) ----
library(readxl)
# Population 2018 (IRIS)
df <- read_xlsx("data-raw/base-ic-evol-struct-pop-2018.xlsx", skip = 5, sheet = "IRIS")
iris10k <- merge(iris10k[,c("CODE_IRIS", "NOM_IRIS", "TYP_IRIS", "NOM_COM")],
df[,c("IRIS","P18_POP")],
by.x = "CODE_IRIS", by.y = "IRIS", all.x = TRUE)
# Median Income (2018)
df <- read_xlsx("data-raw/BASE_TD_FILO_DISP_IRIS_2019.xlsx", skip = 5, sheet = "IRIS_DISP")
iris10k <- merge(iris10k, df[,c("IRIS","DISP_MED19")],
by.x = "CODE_IRIS", by.y = "IRIS", all.x = TRUE)
# Intersection with study area
iris <- st_intersection(iris10k, paris5k)
```
## Prepare IRIS for travel-time calculation
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").
These `sf` objects are transformed in latitude/longitude (origin-destination calculations requirements and for final export in geojson format).
```{r, eval = FALSE}
# Keep only habitation IRIS for origins calculation
ori <- iris10k[iris10k$TYP_IRIS == "H",]
ori <- st_centroid(ori)
# Transform in long/lat
ori <- st_transform(ori, crs = 4326)
iris <- st_transform(iris, crs = 4326)
```
## Import OSM points of interest
Points of interest (climbing areas) are extracted from OpenStreetMap thanks to the `osmdata` R package (@osmdata).
To access to these OSM features, the OSM key-value pair (or OSM tag) must be set. For climbing areas, the most appropriate is `sport=climbing`. In the [OpenStreetMap wiki](https://wiki.openstreetmap.org/wiki/Tag:sport%3Dclimbing "Tag:sport=climbing in OSM wiki"), it is mentioned that "*sport=climbing should be preferably applied to noded for artificial climbing walls".* Thus, we only consider points responding to the query.
The geographical coverage of the query covers a bounding box of 10 km around Paris (`paris10k`\`).
```{r, eval = FALSE}
# 3. Extract OSM objects (climbing and map layout)----
library(osmdata)
# define a bounding box
q0 <- opq(bbox = paris10k)
# extract climbing areas
q <- add_osm_feature(opq = q0, key = 'sport', value = "climbing")
res <- osmdata_sf(q)
dest <- res$osm_points
dest[,"name"] <- iconv(dest$name, from = "UTF-8", to = "UTF-8")
```
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).
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 :-)
For the presentation of the artificial climbing landscape in Paris and the difference between private - FSGT and FFME structures, have a look to [this notebook](https://observablehq.com/@rysebaert/forewords).
```{r, eval = FALSE}
# Cleaning
private <- dest[!is.na(dest$brand),] # Manage private and associative areas
asso <- dest[!is.na(dest$federation),]
asso$type <- "Associative structure"
private$type <- "Speculative structure"
dest <- rbind(asso, private)
dest$federation[is.na(dest$federation)] <- "Private"
# Find walls and boulders
dest[c("climbing.toprope", "climbing.boulder")][is.na(dest[c("climbing.toprope", "climbing.boulder")])] <- "no"
dest$climbing_type <- ifelse(dest$climbing.toprope == 'yes' &
dest$climbing.boulder == "yes", 'Wall and bouldering',
ifelse(dest$climbing.toprope == 'yes' &
dest$climbing.boulder == "no" , 'Wall',
ifelse(dest$climbing.toprope == 'no' &
dest$climbing.boulder == "yes" ,
'Bouldering', NA)))
# Keep only attributes of interest and rename it
cols <- c("osm_id", "name", "climbing_type", "climbing.length",
"climbing.routes", "type", "federation", "brand")
dest <- dest[,cols]
colnames(dest)[4:5] <- c("climbing_length", "climbing_routes")
# Intersection with bounding box
poi <- st_transform(dest, 2154)
poi <- st_intersection(poi, paris5k)
poi <- st_transform(poi, 4326)
```
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).
```{r, eval = TRUE, echo = FALSE, warning=FALSE, message=FALSE}
library(sf)
poi <- st_read("data-conso/poi.geojson", quiet = TRUE)
iris <- st_read("data-conso/iris.geojson", quiet = TRUE)
com <- st_read("data-conso/com.geojson", quiet = TRUE)
poi <- st_transform(poi, 2154)
iris <- st_transform(iris, 2154)
com <- st_transform(com, 2154)
```
```{r, eval = TRUE, out.width= "100%", warning=FALSE}
library(mapsf)
# Extract centroids from IRIS dedicated to dwellings
ori <- st_centroid(iris)
ori <- ori[ori$TYP_IRIS == "H",]
# Map creation
par(mar = c(0,0,0,0))
# Set a map theme (library mapsf)
my_theme <- list(bg = NA, fg = NA, mar = c(0, 0, 0, 0), tab = TRUE, pos = "left",
inner = TRUE, line = 1.3, cex = 1, font = 2)
# Create the map
mf_init(com, expandBB = c(0,0.4,0,0), theme = my_theme)
mf_typo(
x = iris, var = "TYP_IRIS",
pal = c("peachpuff", "#feb8ff", "#f0e6f0", "#f1f7ab"), lwd = 0.25,
val_order = c("H", "A", "D", "Z"), border = "white", leg_pos = c(631000, 6872000),
leg_title = "IRIS types (H = dwellings)", add = TRUE)
mf_map(ori, pch = 20, col = "red", cex = .2, add = TRUE)
mf_legend(
type = "symb", pos = c(631000, 6864000), val = c("H", "H"),
pt_pch = c(20,20), pt_cex =.2, title = "Origins : IRIS centroids type H",
pal = c("red", "red"))
mf_typo(x = poi, var = "federation", pch = 21, cex = .7,
val_order = c("Private", "FSGT", "FFME"),
pal = c("#377eb8", "#e41a1c", "#ff7f00"),
leg_title = "Destinations:\nArtificial climbing areas",
leg_pos = c(631000, 6860000),
add = TRUE)
mf_map(com, col = NA, border = "black", add = TRUE)
mf_title("Layers presentation for origins-destinations calculation")
mf_scale(size = 5, col = "black", pos = "bottomright")
mf_credits(paste0("Sources : © OpenStreetMap and Contributors, IGN, INSEE, 2022\n",
"Realisation : Ronan Ysebaert, 2022"))
```
## Travel-time calculations with OSRM
Origins and destinations required to compute travel-time calculations are now available. The computation is realized using the `osrm` R package (@osrm). This package allows the computation of routes, trips, isochrones and travel distances matrices (travel time and kilometer distance).
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 [following documentation](https://github.com/Project-OSRM/osrm-backend#using-docker "Run OSRM with docker"), or more specifically for Windows [here](https://gist.github.com/AlexandraKapp/e0eee2beacc93e765113aff43ec77789 "How to set up your own OSRM backend with Docker on Windows").
Once it is done, the connection to the routing engine is operational locally (with the URL `http://localhost:5000/`\` for me).
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).
The bicycle profile is described in the [github OSRM repository](https://github.com/Project-OSRM/osrm-backend/blob/master/profiles/bicycle.lua "OSRM bicycle profile"). 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 ([Liedman (2022)](https://www.liedman.net/2015/04/13/add-elevation-data-to-osrm/ "Adding elevation data to OSRM") ; [Mapbox (2015)](https://blog.mapbox.com/elevation-aware-routing-profiles-in-mapbox-directions-21e182a85165 "Elevation-aware routing profiles in Mapbox Directions")). This will not be considered here.
### IRIS to climbing areas
The code below compute travel-time calculation between the geometric centre of IRIS (`ori`) and artificial climbing areas (`dest`). 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.
Resulting travel-time matrixes are exported in the [data-conso](https://github.com/rysebaert/climbing_paris/tree/main/data-conso) folder for other possible uses (and to avoid running these important calculations systematically).
```{r, eval = FALSE}
# 4. Origin - Destination calculation with OSRM ----
library(osrm)
# Manage ids
row.names(ori) <- ori$CODE_IRIS
# Connexion to osrm local server (the osrm container must running under docker)
options(osrm.server = "http://localhost:5000/", osrm.profile = "bike")
# Origin-destination calculation
# All structures
df <- osrmTable(src = ori, dst = dest, measure = "duration")
df <- data.frame(df$duration)
colnames(df) <- as.character(dest$osm_id)
row.names(df) <- as.character(ori$CODE_IRIS)
write.csv(df, "data-conso/bike-duration.csv")
# Private structures
dest_priv <- dest[dest$type == "Speculative structure",]
df2 <- osrmTable(src = ori, dst = dest_priv, measure = "duration")
df2 <- data.frame(df2$duration)
colnames(df2) <- as.character(dest_priv$osm_id)
row.names(df2) <- as.character(ori$CODE_IRIS)
write.csv(df2, "data-conso/bike-duration-priv.csv")
# FFME
dest_asso <-dest[dest$type == "Associative structure",]
dest_ffme <- dest_asso[dest_asso$federation == "FFME",]
df3 <- osrmTable(src = ori, dst = dest_ffme, measure = "duration")
df3 <- data.frame(df3$duration)
colnames(df3) <- as.character(dest_ffme$osm_id)
row.names(df3) <- as.character(ori$CODE_IRIS)
write.csv(df3, "data-conso/bike-duration-ffme.csv")
# FSGT
dest_fsgt <- dest_asso[dest_asso$federation == "FSGT",]
df4 <- osrmTable(src = ori, dst = dest_fsgt, measure = "duration")
df4 <- data.frame(df4$duration)
colnames(df4) <- as.character(dest_fsgt$osm_id)
row.names(df4) <- as.character(ori$CODE_IRIS)
write.csv(df4, "data-conso/bike-duration-fsgt.csv")
```
This heavy matrix is then manipulated to extract for each IRIS the following information :
- Name of the nearest climbing structure by bike.
- Type of manager (private, FFME or FSGT).
- Time to reach it (in minutes).
- Number of artificial climbing areas at less than 15 minutes by bike (N).
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 ;)
```{r, eval = FALSE}
# 5. Accessibility indicator creation (IRIS) ----
# Name of the nearest structure
df <- read.csv("data-conso/bike-duration.csv", row.names = "X")
colnames(df) <- as.character(dest$osm_id)
osm_id <- colnames(df)[apply(df, 1, which.min)] # Name
osm_id <- data.frame(osm_id, stringsAsFactors = FALSE)
osm_id$iris <- row.names(df)
osm_id <- merge(osm_id, poi[,c("osm_id", "name", "federation")],
by = "osm_id", all.x = TRUE)
# Time to the nearest climbing area
time <- apply(df, 1, min) # Time
time <- data.frame(time, stringsAsFactors = FALSE)
time$iris <- row.names(time)
osm_id <- merge(osm_id, time, by = "iris", all.x = TRUE)
osm_id$geometry <- NULL
# Number of climbing area at less than 15 minutes by bike
n15mn <- df
n15mn <- data.frame(df, stringsAsFactors = FALSE)
n15mn[n15mn <= 15] <- 1
n15mn[n15mn > 15] <- 0
n15mn$N <- rowSums(n15mn)
n15mn$iris <- row.names(n15mn)
osm_id <- merge(osm_id, n15mn[,c("iris", "N")], by = "iris",
all.x = TRUE)
osm_id <- osm_id[,c(1,3:6)]
colnames(osm_id) <- c("CODE_IRIS", "ALL_NAME", "TYPE_STRUCT", "ALL_TIME",
"N_15MN")
iris <- merge(iris, osm_id, by = "CODE_IRIS", all.x = TRUE)
# Private climbing club (fees $$$)
# Name of the nearest structure
df2 <- read.csv("data-conso/bike-duration-priv.csv", row.names = "X")
colnames(df2) <- as.character(dest_priv$osm_id)
osm_id <- colnames(df2)[apply(df2, 1, which.min)] # Name
osm_id <- data.frame(osm_id, stringsAsFactors = FALSE)
osm_id$iris <- row.names(df2)
osm_id <- merge(osm_id, poi[,c("osm_id", "name", "type")],
by = "osm_id", all.x = TRUE)
# Time to the nearest climbing area
time <- apply(df2, 1, min) # Time
time <- data.frame(time, stringsAsFactors = FALSE)
time$iris <- row.names(time)
osm_id <- merge(osm_id, time, by = "iris", all.x = TRUE)
osm_id$geometry <- NULL
# Number of climbing area at less than 15 minutes by bike
n15mn <- df2
n15mn <- data.frame(df2, stringsAsFactors = FALSE)
n15mn[n15mn <= 15] <- 1
n15mn[n15mn > 15] <- 0
n15mn$N <- rowSums(n15mn)
n15mn$iris <- row.names(n15mn)
osm_id <- merge(osm_id, n15mn[,c("iris", "N")], by = "iris",
all.x = TRUE)
osm_id <- osm_id[,c(1,3,5:6)]
colnames(osm_id) <- c("CODE_IRIS", "PRIV_NAME", "PRIV_TIME",
"N_PRIV_15MN")
iris <- merge(iris, osm_id, by = "CODE_IRIS", all.x = TRUE)
# FFME associative structure
# Name of the nearest structure
df3 <- read.csv("data-conso/bike-duration-ffme.csv", row.names = "X")
colnames(df3) <- as.character(dest_ffme$osm_id)
osm_id <- colnames(df3)[apply(df3, 1, which.min)] # Name
osm_id <- data.frame(osm_id, stringsAsFactors = FALSE)
osm_id$iris <- row.names(df3)
osm_id <- merge(osm_id, poi[,c("osm_id", "name", "type")],
by = "osm_id", all.x = TRUE)
# Time to the nearest climbing area
time <- apply(df3, 1, min) # Time
time <- data.frame(time, stringsAsFactors = FALSE)
time$iris <- row.names(time)
osm_id <- merge(osm_id, time, by = "iris", all.x = TRUE)
osm_id$geometry <- NULL
# Number of climbing area at less than 15 minutes by bike
n15mn <- df3
n15mn <- data.frame(df3, stringsAsFactors = FALSE)
n15mn[n15mn <= 15] <- 1
n15mn[n15mn > 15] <- 0
n15mn$N <- rowSums(n15mn)
n15mn$iris <- row.names(n15mn)
osm_id <- merge(osm_id, n15mn[,c("iris", "N")], by = "iris",
all.x = TRUE)
osm_id <- osm_id[,c(1,3,5:6)]
colnames(osm_id) <- c("CODE_IRIS", "FFME_NAME", "FFME_TIME",
"N_FFME_15MN")
iris <- merge(iris, osm_id, by = "CODE_IRIS", all.x = TRUE)
# FSGT associative structure
# Name of the nearest structure
df4 <- read.csv("data-conso/bike-duration-fsgt.csv", row.names = "X")
colnames(df4) <- as.character(dest_fsgt$osm_id)
osm_id <- colnames(df4)[apply(df4, 1, which.min)] # Name
osm_id <- data.frame(osm_id, stringsAsFactors = FALSE)
osm_id$iris <- row.names(df4)
osm_id <- merge(osm_id, poi[,c("osm_id", "name", "type")],
by = "osm_id", all.x = TRUE)
# Time to the nearest climbing area
time <- apply(df4, 1, min) # Time
time <- data.frame(time, stringsAsFactors = FALSE)
time$iris <- row.names(time)
osm_id <- merge(osm_id, time, by = "iris", all.x = TRUE)
osm_id$geometry <- NULL
# Number of climbing area at less than 15 minutes by bike
n15mn <- df4
n15mn <- data.frame(df4, stringsAsFactors = FALSE)
n15mn[n15mn <= 15] <- 1
n15mn[n15mn > 15] <- 0
n15mn$N <- rowSums(n15mn)
n15mn$iris <- row.names(n15mn)
osm_id <- merge(osm_id, n15mn[,c("iris", "N")], by = "iris",
all.x = TRUE)
osm_id <- osm_id[,c(1,3,5:6)]
colnames(osm_id) <- c("CODE_IRIS", "FSGT_NAME", "FSGT_TIME",
"N_FSGT_15MN")
iris <- merge(iris, osm_id, by = "CODE_IRIS", all.x = TRUE)
```
### Characterizing the POI neighbourhood
Then, the socio-economic neighbourhood of each climbing area is characterized.
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 :
- Total population at less than 15 minutes by bike. This can be considered as an amount of "local social demand".
- Minimum, mean and maximum of median income of IRIS at less than 15 minutes by bike.
```{r, eval = FALSE}
# 6. Characterise the POI neighbourhood ----
t.df <- data.frame(t(df))
colnames(t.df) <- iris10k[iris10k$TYP_IRIS == "H",]$CODE_IRIS
t.df$osm_id <- dest$osm_id
t.df <- t.df[t.df$osm_id %in% poi$osm_id,]
poi_socio <- data.frame(matrix(nrow = 0, ncol = 5))
colnames(poi_socio) <- c("osm_id", "SUM_POP18", "MIN_REV19", "MOY_REV19", "MAX_REV19")
for (i in 1:nrow(t.df)){
tmp1 <- t.df[, t.df[i, ] < 15]
tmp2 <- data.frame(CODE_IRIS = colnames(tmp1))
tmp2 <- merge(tmp2, iris10k[,c("CODE_IRIS", "P18_POP", "DISP_MED19")],
all.x = TRUE)
poi_socio[i,1] <- row.names(tmp1)[i]
poi_socio[i,2] <- sum(tmp2$P18_POP, na.rm = TRUE)
poi_socio[i,3] <- min(tmp2$DISP_MED19, na.rm = TRUE)
poi_socio[i,4] <- mean(tmp2$DISP_MED19, na.rm = TRUE)
poi_socio[i,5] <- max(tmp2$DISP_MED19, na.rm = TRUE)
}
poi <- merge(poi, poi_socio, by = "osm_id", all.x = TRUE)
```
### Output
Below is mapped one indicator calculated previously at IRIS level : time required to reach the nearest climbing area from the each populated IRIS centroid.
```{r, eval = TRUE, out.width= "100%", warning=FALSE}
library(mapsf)
# Create the map
mf_init(com, expandBB = c(0,0.4,0,0), theme = my_theme)
cols <- mf_get_pal(n = 10, pal = "RdYlGn", rev = TRUE)
thr <- c(0, 2.5, 5, 7.5, 10, 12.5, 15, 20, 25, 30, max(iris$ALL_TIME, na.rm = TRUE))
mf_choro(
x = iris, var = "ALL_TIME",
pal = cols, lwd = 0.25, breaks = thr, border = "white",
leg_pos = c(631000, 6872000),
leg_title = "Nearest climbing area\n(all structures, minutes)",
col_na = "lightgrey", leg_no_data = "No dedicated to housing", add = TRUE)
mf_map(x = poi, pch = 21, cex = .9, bg = "white", add = TRUE)
mf_map(com, col = NA, border = "black", add = TRUE)
mf_label(x = poi, var = "name", cex = .4, halo = TRUE, overlap = FALSE,
bg = "#ffffff80", pos = 4, add = TRUE)
mf_title("Time to reach the nearest climbing area")
mf_scale(size = 5, col = "black", pos = "bottomright")
mf_credits(paste0("Sources : © OpenStreetMap and Contributors, IGN, INSEE, 2022\n",
"Realisation : Ronan Ysebaert, 2022"))
```
## Travel time isochrones
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 [MAUP](https://en.wikipedia.org/wiki/Modifiable_areal_unit_problem) effects. This is done by building isochrones of equivalent time-distance coming from climbing areas, using the `mapiso` R package (@mapiso). Below are reminded the required steps to create polygons of equipotential from a regular grid of points :
- Create a regular grid (150m resolution in our case) and extract the centroids.
- Compute travel time indicators with the `osrmtable` function of the `osrm` R package, from grid centroids to climbing areas.
- Get the minimum value of the resulting matrix and join the result to the regular grid layer.
- Create polygons with `mapiso` 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).
```{r, eval = FALSE}
## 4.3 Isochrones from a regular grid to climbing areas ----
# Compute travel time from grid to climbing areas
# Create grid and extract centroids (cell size = 150 m)
mygrid <- st_make_grid(paris5k, cellsize = 150)
mygrid <- st_centroid(mygrid)
mygrid <- st_sf(ID = 1:length(mygrid), geometry = mygrid)
dest <- st_transform(dest, 2154)
dest_priv <- dest[dest$type == "Speculative structure",]
dest_fsgt <- dest[dest$federation == "FSGT",]
# Compute travel time from grid centroids to all climbing areas
df5 <- osrmTable(src = mygrid, dst = dest, measure = "duration")
df5 <- data.frame(df5$duration)
write.csv(df5, "data-conso/grid-bike-duration.csv", row.names = FALSE)
df5 <- read.csv("data-conso/grid-bike-duration.csv")
colnames(df5) <- as.character(dest$osm_id)
time <- data.frame(mygrid$ID, apply(df5, 1, min)) # find minimum value
colnames(time) <- c("ID", "TIME_ALL")
mygrid <- merge(mygrid, time, by = "ID", all.x = TRUE) # merge time to grid
# Compute travel time from grid centroids to private climbing areas
df6 <- osrmTable(src = mygrid, dst = dest_priv, measure = "duration")
df6 <- data.frame(df6$duration)
write.csv(df6, "data-conso/grid-bike-duration_priv.csv", row.names = FALSE)
df6 <- read.csv("data-conso/grid-bike-duration_priv.csv")
colnames(df6) <- as.character(dest_priv$osm_id)
time <- data.frame(mygrid$ID, apply(df6, 1, min)) # find minimum value
colnames(time) <- c("ID", "TIME_PRIV")
mygrid <- merge(mygrid, time, by = "ID", all.x = TRUE) # merge time to grid
# Compute travel time from grid centroids to FSGT climbing areas
df7 <- osrmTable(src = mygrid, dst = dest_fsgt, measure = "duration")
df7 <- data.frame(df7$duration)
write.csv(df7, "data-conso/grid-bike-duration_fsgt.csv", row.names = FALSE)
df7 <- read.csv("data-conso/grid-bike-duration_fsgt.csv")
colnames(df7) <- as.character(dest_fsgt$osm_id)
time <- data.frame(mygrid$ID, apply(df7, 1, min)) # find minimum value
colnames(time) <- c("ID", "TIME_FSGT")
mygrid <- merge(mygrid, time, by = "ID", all.x = TRUE) # merge time to grid
# Compute isochrones
# define breaks (based on quantile analysis)
library(mapiso)
thr <- c(0, 2.5, 5, 7.5, 10, 12.5, 15, 20, 25, 30, max(mygrid$TIME_FSGT))
iso_all <- mapiso(x = mygrid, var = "TIME_ALL", breaks = thr, mask = paris5k)
iso_fsgt <- mapiso(x = mygrid, var = "TIME_FSGT", breaks = thr, mask = paris5k)
iso_priv <- mapiso(x = mygrid, var = "TIME_PRIV", breaks = thr, mask = paris5k)
```
### Output
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.
```{r, eval = TRUE, echo = FALSE, warning=FALSE}
library(sf)
iso_all <- st_read("data-conso/iso_all.geojson", quiet = TRUE)
mygrid <- st_read("data-conso/mygrid.geojson", quiet = TRUE)
iso_all <- st_transform(iso_all, 2154)
```
```{r, eval = TRUE, out.width= "100%", warning=FALSE}
# thresholds, colours and background colours
thr <- c(0, 2.5, 5, 7.5, 10, 12.5, 15, 20, 25, 30, max(mygrid$TIME_ALL))
# Map input grid
mf_init(com, expandBB = c(0,0.4,0,0), theme = my_theme)
mf_map(mygrid, var = "TIME_ALL", pch = 21, cex = .4, border = NA,
type = "choro", breaks = thr, pal = cols, leg_pos = c(631000, 6872000),
leg_title = "Time to reach\nthe nearest climbing area\nfrom a 150m regular\ngrid centroids",
add = TRUE)
mf_map(poi, pch = 21, add = TRUE)
mf_title("Isochrones input : travel time from a 150 m regular grid")
mf_scale(size = 5, col = "black", pos = "bottomright")
mf_credits(paste0("Sources : © OpenStreetMap and Contributors, 2022\n",
"Realisation : Ronan Ysebaert, 2022"))
# Map resulting isochrones
mf_init(com, expandBB = c(0,0.4,0,0), theme = my_theme)
mf_map(iso_all, var = "isomin", type = "choro", breaks = thr, pal = cols,
border = NA, leg_pos = c(631000, 6872000),
leg_title = "Time to reach\nthe nearest climbing area\nby bike",
add = TRUE)
mf_map(com, col = NA, add = TRUE)
mf_map(poi, pch = 21, add = TRUE)
mf_title("Isochrones output : transformation of regularly spaced grids into contour polygons")
mf_scale(size = 5, col = "black", pos = "bottomright")
mf_credits(paste0("Sources : © OpenStreetMap and Contributors, IGN, 2022\n",
"Realisation : Ronan Ysebaert, 2022"))
```
## OSRM climbing trip
```{r, echo = FALSE}
library(sf)
trip <- st_read("data-conso/trip.geojson", quiet = TRUE)
poi <- st_read("data-conso/poi.geojson", quiet = TRUE)
dest_fsgt <- poi[poi$federation == "FSGT",]
```
`osrmTrip` is a function from the `osrm` package (@osrm) 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).
This function is applied to the climbing areas held by the FSGT federation.
```{r, eval = FALSE}
dest_fsgt <- st_transform(dest_fsgt, 2154)
dest_fsgt <- st_intersection(dest_fsgt, paris_5k)
dest_fsgt <- st_transform(dest_fsgt, 4326)
trip <- osrmTrip(loc = dest_fsgt)
trip <- trip[[1]]$trip
```
To reach the `r nrow(dest_fsgt)` 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 `r sum(trip$duration)` minutes and `r sum(trip$distance)` kilometres.
```{r, out.width= "100%", eval = TRUE}
library(maptiles)
osm <- get_tiles(x = trip, crop = TRUE, zoom = 13)
theme <- mf_theme(mar = c(0,0,1.2,0), inner = FALSE, line = 1.2, cex = .9,
pos = "center", tab = FALSE)
mf_raster(osm)
mf_map(trip, lwd = 4, add = TRUE, col = "blue")
mf_map(trip, lwd = 1, col = "white", add = TRUE)
mf_map(dest_fsgt, pch = 20, col = "red", add = TRUE)
mf_title("Fastest cycling trip to reach all FSGT climbing areas")
mf_credits(get_credit("OpenStreetMap"), pos = "bottomright",
bg = "#ffffff80")
```
### Manual corrections (out of OSM)
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.
Consequently, I prefer not to change these attributes in the OSM database, but directly in my R programme.
```{r, eval = FALSE}
# Correct MurMur and Rename ESC15
poi[17,"climbing_length"] <- 17
poi[16,"name"] <- "ESC 15 - La Plaine"
poi[31,"name"] <- "ESC 15 - Croix Nivert"
```
## Simplify geometries
Geometries are quite detailed. The library `rmapshaper` (@rmapshaper) 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.
We also extract the IRIS located at less than 15 minutes from a artificial climbing area for some upcoming maps.
```{r, eval = FALSE}
library(rmapshaper)
iris <- ms_simplify(iris, keep = 0.09)
# Communes aggregation (layout)
com <- aggregate(iris[,c("INSEE_COM", "NOM_COM")],
by = list(iris$INSEE_COM),
FUN = head, 1)
# Extract IRIS at less than 15 minutes by bike
iris15 <- iris[iris$ALL_TIME < 15,]
iris15 <- iris15[!is.na(iris15$ALL_TIME),]
```
## Export results
Data preparation is over. Resulting `sf` objects that will be used for data visualizations are exported in geojson files in the [data-conso](https://github.com/rysebaert/climbing_paris/tree/main/data-conso) folder.
```{r, eval = FALSE}
# Export IRIS, POI, com layers
st_write(com, "data-conso/com.geojson")
st_write(iris, "data-conso/iris.geojson")
st_write(poi, "data-conso/poi.geojson")
st_write(iris15, "data-conso/iris15.geojson")
# Export material related to isochrones
mygrid <- st_transform(mygrid, 4326)
iso_all <- st_transform(iso_all, 4326)
iso_fsgt <- st_transform(iso_fsgt, 4326)
iso_priv <- st_transform(iso_priv, 4326)
st_write(mygrid, "data-conso/mygrid.geojson")
st_write(iso_all, "data-conso/iso_all.geojson")
st_write(iso_fsgt, "data-conso/iso_fsgt.geojson")
st_write(iso_priv, "data-conso/iso_priv.geojson")
# Export material related to travel-trip
st_write(trip, "data-conso/trip.geojson")
```
## Session info (R)
```{r, echo=FALSE, message=FALSE}
library(osmdata)
library(osrm)
library(sf)
library(mapsf)
library(rmapshaper)
library(readxl)
sessionInfo()
```
# Data visualization with Observable JavaScript (ojs)
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.
The computing language is [Observable JavaScript (ojs)](https://observablehq.com/\@observablehq/observables-not-javascript). It is possible to include this programming language in Quarto chunks.
This section imports some visualizations realized in an [Observable collection](https://observablehq.com/collection/\@rysebaert/climbing_paris). Have a look to this resource to see the overall project !
All the maps produced below use the bertin.js library (@bertin). Have a look to the documentation in this [npm repository](https://www.npmjs.com/package/bertin) or in this [Observable Collection](https://observablehq.com/collection/@neocartocnrs/bertin) to see the possibilities offered by this library to the map creator !
## Import consolidated data
Geojson files coming from the data preparation precessing realized in a R programming language and described above are imported.
```{ojs}
iris = FileAttachment("data-conso/iris.geojson").json()
poi = FileAttachment("data-conso/poi.geojson").json()
com = FileAttachment("data-conso/com.geojson").json()
iris15 = FileAttachment("data-conso/iris15.geojson").json()
iso_all = FileAttachment("data-conso/iso_all.geojson").json()
iso_priv = FileAttachment("data-conso/iso_priv.geojson").json()
iso_fsgt = FileAttachment("data-conso/iso_fsgt.geojson").json()
trip = FileAttachment("data-conso/trip.geojson").json()
```
Bertin.js (@bertin), geotoolbox.js (@geotoolbox) geoverview.js (@geoverview) libraries are imported. These libraries will be used for creating the maps.
```{ojs}
bertin = require('bertin')
view = require("geoverview").then((f) => f.view)
geotoolbox = require('geotoolbox')
```
## Layers attributes and metadata
Three geographical layers will be used :
- **iris** : IRIS intersecting the study area (polygons layer).
- **poi** : climbing structures included the study area (points layer).
- **com** : Municipalities intersecting the study area (polygons layer). This layer will only be used for the map layout and better understand the location of the poi and iris layers : IRIS, the lowest territorial division in France, is not really known by the population.
The first two geographical layers include attributes coming from the data preparation process, that will be mapped and plotted in the next section of the document. In this part, we present the layers in several ways to understand the information we have in hand for producing the data visualization.
### Interactive map
Made with geoverview library. Click on the points / polygons to have an overview of their respective attributes and values.
```{ojs}
data = new Map([
["Climbing areas (dots)", poi],
["IRIS (polygons)", iris],
["Layout municipalities (polygons)", com]
])
viewof geojson = Inputs.select(data, { label: "Select a geojson" })
viewof style = Inputs.select(["voyager", "night", "fulldark","positron","icgc","osmbright","hibrid"], { label: "Select a style" })
map = view(geojson, {
style: style
})
```
### Attributes and metadata
**Attribute table (iris layer)**
```{ojs}
Inputs.table(iris.features.map((d) => d.properties))
```
**Indicators definition (iris layer)**
| id | Description | Data source |
|-------------|-----------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|
| CODE_IRIS | IRIS code | INSEE, IGN |
| NOM_IRIS | IRIS Name | INSEE, IGN |
| TYP_IRIS | IRIS type (H for dwellings) | INSEE, IGN |
| P18_POP | Population in 2018 | INSEE |
| DISP_MED19 | Disposable median income in 2019 | INSEE |
| ALL_NAME | Name of the nearest artificial climbing area reachable by bike (all structures) | (c)OpenStreetMap and contributors, Ronan Ysebaert |
| TYPE_STRUCT | Manager of the nearest artificial climbing area reachable by bike (private, FSGT or FFME) | (c)OpenStreetMap and contributors, Ronan Ysebaert |
| ALL_TIME | Time by bike to reach the nearest artificial climbing area. | (c)OpenStreetMap and contributors, Ronan Ysebaert |
| N_15MN | Number of climbing areas accessible in 15 minutes by bike from the IRIS centroid (all structures) | (c)OpenStreetMap and contributors, Ronan Ysebaert |
| PRIV_NAME | Name of the nearest artificial climbing area by bike (Private structure) | (c)OpenStreetMap and contributors, Ronan Ysebaert |
| PRIV_TIME | Time by bike to reach the nearest artificial climbing area (Private structure) | (c)OpenStreetMap and contributors, Ronan Ysebaert |
| N_PRIV_15MN | Number of climbing areas accessible in 15 minutes by bike from the IRIS centroid (private structures) | (c)OpenStreetMap and contributors, Ronan Ysebaert |
| FFME_NAME | Name of the nearest artificial climbing area by bike (Associative structure, federation : FFME) | (c)OpenStreetMap and contributors, Ronan Ysebaert |
| FFME_TIME | Time by bike to reach the nearest artificial climbing area (Associative structure, federation : FFME) | (c)OpenStreetMap and contributors, Ronan Ysebaert |
| N_FFME_15MN | Number of climbing areas accessible in 15 minutes by bike from the IRIS centroid (Associative structure, federation : FFME) | (c)OpenStreetMap and contributors, Ronan Ysebaert |
| FSGT_NAME | Name of the nearest artificial climbing area by bike (Associative structure, federation : FSGT) | (c)OpenStreetMap and contributors, Ronan Ysebaert |
| FSGT_TIME | Time by bike to reach the nearest artificial climbing area (Associative structure, federation : FSGT) | (c)OpenStreetMap and contributors, Ronan Ysebaert |
| N_FSGT_15MN | Number of climbing areas accessible in 15 minutes by bike from the IRIS centroid (Associative structure, federation : FSGT) | (c)OpenStreetMap and contributors, Ronan Ysebaert |
**Attribute table (poi layer)**
```{ojs}
Inputs.table(poi.features.map((d) => d.properties))
```
**Indicators definition (poi layer)**
| id | Description | Data source |
|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------|
| osm_id | OpenStreetMap identifier (responding to the query sport=climbing in the bounding box of the study area) | (c)OpenStreetMap and contributors |
| name | Name of the artificial climbing area | (c)OpenStreetMap and contributors |
| climbing_type | If the artificial climbing area is a wall (need a rope to climb), dedicated to bouldering, or both | (c)OpenStreetMap and contributors, Ronan Ysebaert |
| climbing_length | Max. height of the wall (if adapted, for walls and not for bouldering) | (c)OpenStreetMap and contributors |
| climbing_routes | Number of climbing routes, materialized by belay station (if adapted, for walls and not for bouldering). Note that in artificial climbing, a same belay station can serve several climbing routes | (c)OpenStreetMap and contributors |
| type | If the climbing area is speculative (manage by a private brand) or associative | (c)OpenStreetMap and contributors, Ronan Ysebaert |
| federation | Name of the manager (FFME, FSGT or private) | (c)OpenStreetMap and contributors, Ronan Ysebaert |
| brand | Name of the brand managing the private structure | (c)OpenStreetMap and contributors |
| SUM_POP18 | Population at less than 15 minutes by bike of the artificial climbing area (IRIS centroids). | INSEE, (c)OpenStreetMap and contributors, Ronan Ysebaert |
| MIN_REV19 | Minimum of the median income for the IRIS located at less than 15 minutes by bike | INSEE, (c)OpenStreetMap and contributors, Ronan Ysebaert |
| MOY_REV19 | Mean of the Median income for the IRIS located at less than 15 minutes by bike | INSEE, (c)OpenStreetMap and contributors, Ronan Ysebaert |
| MAX_REV19 | Maximum of the Median income for the IRIS located at less than 15 minutes by bike | INSEE, (c)OpenStreetMap and contributors, Ronan Ysebaert |
## Wall's characteristics
This interactive map displays the artificial climbing offer in Paris and its surroundings, according artificial climbing specificities: top rope climbing (walls) / bouldering, climbing height, number of routes, manager of the artificial climbing area.
```{ojs}
//Manage map projection
lambert93 = "+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"
// Map parameters to play with it
viewof ind = Inputs.radio(["climbing_length", "climbing_routes"], {label: "Wall height / Number of routes", value: "climbing_length"})
viewof k = Inputs.range([10, 300], { label: "Spikes height", step: 1, value: 90 })
viewof w = Inputs.range([2, 30], { label: "Spikes / dots width", step: 1, value: 15 })
// Spike map with tooltips
map1 = bertin.draw({
params: {
width: 750,
projection: lambert93,
extent: com
},
layers: [
{
type: "spikes",
geojson: poi,
values: ind,
fillOpacity: 0.2,
k: k,
w: w,
fill: {
type: "typo",
values: "federation",
colors: ["#9990f0", "#fcb456", "#ba0b25"],
leg_title: `Wall's managers`,
leg_x: 600,
leg_y: 550
},
stroke: {
type: "typo",
values: "federation",
colors: ["#9990f0", "#fcb456", "#ba0b25"]
},
leg_x: 15,
leg_y: 15,
leg_round: 0,
leg_title: `Height (meters) or routes number`,
tooltip: {
fields: [
"$name",
"$climbing_length",
"(height in meters)",
"$climbing_routes",
"(nb. routes)",
"$federation",
"(manager)"
],
fill: ["black", "black", "black", "black", "black", "black", "black"],
fontWeight: [
"bold",
"normal",
"normal",
"normal",
"normal",
"normal",
"normal"
],
fontSize: [14, 12, 10, 12, 10, 12, 10],
col: "white"
}
},
{
geojson: poi,
symbol_size: 10 * w,
symbol: "circle",
fill: {
type: "typo",
values: "climbing_type",
colors: ["white", "lightgrey", "grey"],
leg_title: `Climbing type`,
leg_x: 600,
leg_y: 430
},
stroke: {
type: "typo",
values: "federation",
colors: ["#9990f0", "#fcb456", "#ba0b25"]
},
strokeWidth: 2,
tooltip: {
fields: ["$name", "$climbing_type"],
fill: ["black", "black"],
fontWeight: ["bold", "normal"],
fontSize: [12, 10],
col: "white"
}
},
{
type: "text",
position: "topright",
text: "Climbing hot spots",
frame_opacity: 0.7,
baseline: "hanging",
fill: "black",
fontSize: 25,
margin: 4,
fontWeight: "bold",
fontFamily: "Ubuntu"
},
{
type: "layer",
geojson: com,
stroke: "white",
fill: "peachpuff",
tooltip: ["$NOM_COM"]
},
{
type: "scalebar",
units: "miles"
},
{
type: "footer",
text:
"Sources: (c)OpenStreetMap and contributors, INSEE, IGN, 2022\nRealisation: Ronan Ysebaert, 2022"
}
]
})
```
## Nearest wall
The nearest climbing area by bike from each populated IRIS by wall manager: private or associative (FSGT or FFME).
```{ojs}
// Categorical map with tooltips
map2 = bertin.draw({
params: {
width: 750,
projection: lambert93,
extent: com
},
layers: [
{
geojson: poi,