03:00
Challenge 1: ð 5 mins
Explore and plot by vector layer attributes
Challenge 2: ð 3 mins
+Challenge 2: 3 mins
Explore the attributes associated with the point_Delft
and boundary_Delft
spatial objects.
- How many attributes does each have? @@ -487,7 +686,7 @@
- Create a new object that only contains the motorways in Delft.
- How many features does the new object have? @@ -520,7 +719,7 @@
- Make the lines where bicycles are not allowed THINNER than the roads where bicycles are allowed. @@ -590,7 +789,7 @@
- Use the data located in your data folder:
nl-gemeenten.shp
.
@@ -621,7 +820,7 @@ Color each point by the leisure type.
@@ -656,7 +855,7 @@ - Import
nl-gemeenten.shp
and filter only the municipalities in South Holland.
@@ -702,7 +901,7 @@ - f Fullscreen \n
- s Speaker View \n
- o Slide Overview \n
- e PDF Export Mode \n
- b Toggle Chalkboard \n
- c Toggle Notes Canvas \n
- d Download Drawings \n
- ? Keyboard Help \n
- f Fullscreen \n
- s Speaker View \n
- o Slide Overview \n
- e PDF Export Mode \n
- b Toggle Chalkboard \n
- c Toggle Notes Canvas \n
- d Download Drawings \n
- ? Keyboard Help \n
Challenge 2: ð 3 mins
⣠A) location B) leisure C) osm_id
03:00
Challenge 2: ð 3 mins
Challenge 3: ð¢ 5 mins
+Challenge 3: 5 mins
Challenge 3: ð¢ 5 mins
05:00
Challenge 3: ð¢ 5 mins
levels(factor(lines_Delft$highway))
-
-motorway_Delft <- lines_Delft %>%
- filter(highway == "motorway")
-
-motorway_Delft %>%
- mutate(length = st_length(.)) %>%
- select(everything(), geometry) %>%
- summarise(total_length = sum(length))
-
-nrow(motorway_Delft)
-
-ggplot(data = motorway_Delft) +
- geom_sf(size = 1.5) +
- ggtitle("Mobility network of Delft", subtitle = "Motorways") +
- coord_sf()
levels(factor(lines_Delft$highway))
+
+motorway_Delft <- lines_Delft %>%
+ filter(highway == "motorway")
+
+motorway_Delft %>%
+ mutate(length = st_length(.)) %>%
+ select(everything(), geometry) %>%
+ summarise(total_length = sum(length))
+
+nrow(motorway_Delft)
+
+ggplot(data = motorway_Delft) +
+ geom_sf(size = 1.5) +
+ ggtitle("Mobility network of Delft", subtitle = "Motorways") +
+ coord_sf()
Challenge 4: ð 3 mins
+Challenge 4: 3 mins
In the previous example, we set the line widths to be 1, 0.75, 0.5, and 0.25. In our case line thicknesses are consistent with the hierarchy of the selected road types, but in some cases we might want to show a different hierarchy.
Letâs create another plot where we show the different line types with the following thicknesses:
-
@@ -559,7 +758,7 @@
Challenge 4: ð 3 mins
03:00
Challenge 4: ð 3 mins
levels(factor(lines_Delft$highway))
-
-line_widths <- c(0.25, 0.75, 0.5, 1)
-
-ggplot(data = lines_Delft_selection) +
- geom_sf(aes(size = highway)) +
- scale_size_manual(values = line_widths) +
- labs(size = "Road Size") +
- ggtitle("Mobility network of Delft", subtitle = "Roads & Cycleways - Line width varies") +
- coord_sf()
levels(factor(lines_Delft$highway))
+
+line_widths <- c(0.25, 0.75, 0.5, 1)
+
+ggplot(data = lines_Delft_selection) +
+ geom_sf(aes(size = highway)) +
+ scale_size_manual(values = line_widths) +
+ labs(size = "Road Size") +
+ ggtitle("Mobility network of Delft", subtitle = "Roads & Cycleways - Line width varies") +
+ coord_sf()
Challenge 5: ð¡ 5 mins
+Challenge 5: 5 mins
Create a plot that emphasizes only roads where bicycles are allowed, as follows:
Challenge 5: ð¡ 5 mins
05:00
Challenge 5: ð¡ 5 mins
levels(factor(lines_Delft_selection$highway))
-
-lines_Delft_bicycle <- lines_Delft %>%
- filter(highway == "cycleway")
-
-ggplot() +
- geom_sf(data = lines_Delft) +
- geom_sf(data = lines_Delft_bicycle, color = "magenta", size = 2) +
- ggtitle("Mobility network of Delft", subtitle = "Roads dedicated to bikes") +
- coord_sf()
levels(factor(lines_Delft_selection$highway))
+
+lines_Delft_bicycle <- lines_Delft %>%
+ filter(highway == "cycleway")
+
+ggplot() +
+ geom_sf(data = lines_Delft) +
+ geom_sf(data = lines_Delft_bicycle, color = "magenta", size = 2) +
+ ggtitle("Mobility network of Delft", subtitle = "Roads dedicated to bikes") +
+ coord_sf()
Challenge 6: ð 3 mins
+Challenge 6: 3 mins
Create a map of the municipal boundaries in the Netherlands, as follows:
Challenge 6: ð 3 mins
03:00
Challenge 6: ð 3 mins
municipal_boundaries_NL <- st_read(here("episodes", "data", "nl-gemeenten.shp"))
-str(municipal_boundaries_NL)
-levels(factor(municipal_boundaries_NL$ligtInPr_1))
-
-ggplot(data = municipal_boundaries_NL) +
- geom_sf(aes(color = ligtInPr_1), size = 1) +
- ggtitle("Contiguous NL Municipal Boundaries") +
- coord_sf()
municipal_boundaries_NL <- st_read(here("episodes", "data", "nl-gemeenten.shp"))
+str(municipal_boundaries_NL)
+levels(factor(municipal_boundaries_NL$ligtInPr_1))
+
+ggplot(data = municipal_boundaries_NL) +
+ geom_sf(aes(color = ligtInPr_1), size = 1) +
+ ggtitle("Contiguous NL Municipal Boundaries") +
+ coord_sf()
Plot multiple shapefiles
Challenge 7: ð 5 mins
+Challenge 7: 5 mins
Create a map of leisure locations only including playground
and picnic_table
:
Challenge 7: ð 5 mins
05:00
Challenge 7: ð 5 mins
leisure_locations_selection <- st_read(here("episodes", "data", "delft-leisure.shp")) %>%
- filter(leisure %in% c("playground", "picnic_table"))
-
-blue_orange <- c("cornflowerblue", "darkorange")
-
-p <- ggplot() +
- geom_sf(data = lines_Delft_selection, aes(color = highway)) +
- scale_color_manual(name = "Line Type", values = road_colors) +
- ggtitle("Road network and leisure")
-
-p +
- geom_sf(data = leisure_locations_selection, aes(fill = leisure), shape = 21) +
- scale_fill_manual(name = "Leisure Type", values = blue_orange)
-
-p +
- geom_sf(data = leisure_locations_selection, aes(fill = leisure, shape = leisure), size = 3) +
- scale_fill_manual(name = "Leisure Type", values = blue_orange) +
- scale_shape_manual(name = "Leisure Type", values = c(21, 22))
leisure_locations_selection <- st_read(here("episodes", "data", "delft-leisure.shp")) %>%
+ filter(leisure %in% c("playground", "picnic_table"))
+
+blue_orange <- c("cornflowerblue", "darkorange")
+
+p <- ggplot() +
+ geom_sf(data = lines_Delft_selection, aes(color = highway)) +
+ scale_color_manual(name = "Line Type", values = road_colors) +
+ ggtitle("Road network and leisure")
+
+p +
+ geom_sf(data = leisure_locations_selection, aes(fill = leisure), shape = 21) +
+ scale_fill_manual(name = "Leisure Type", values = blue_orange)
+
+p +
+ geom_sf(data = leisure_locations_selection, aes(fill = leisure, shape = leisure), size = 3) +
+ scale_fill_manual(name = "Leisure Type", values = blue_orange) +
+ scale_shape_manual(name = "Leisure Type", values = c(21, 22))
Handling spatial projections
Challenge 8: ð° 3 mins
+Challenge 8: 3 mins
Create a map of the South Holland, as follows:
Challenge 8: ð° 3 mins
03:00
Challenge 8: ð° 3 mins
boundary_ZH <- municipal_boundary_NL %>%
- filter(ligtInPr_1 == "Zuid-Holland")
-
-ggplot() +
- geom_sf(data = boundary_ZH, aes(color ="color"), show.legend = "line") +
- scale_color_manual(name = "", labels = "Municipal Boundaries", values = c("color" = "gray18")) +
- geom_sf(data = boundary_Delft, aes(shape = "shape"), color = "purple", fill = "purple") +
- scale_shape_manual(name = "", labels = "Municipality of Delft", values = c("shape" = 19)) +
- ggtitle("Delft location in South Holland") +
- theme(legend.background = element_rect(color = NA)) +
- coord_sf()
boundary_ZH <- municipal_boundary_NL %>%
+ filter(ligtInPr_1 == "Zuid-Holland")
+
+ggplot() +
+ geom_sf(data = boundary_ZH, aes(color ="color"), show.legend = "line") +
+ scale_color_manual(name = "", labels = "Municipal Boundaries", values = c("color" = "gray18")) +
+ geom_sf(data = boundary_Delft, aes(shape = "shape"), color = "purple", fill = "purple") +
+ scale_shape_manual(name = "", labels = "Municipality of Delft", values = c("shape" = 19)) +
+ ggtitle("Delft location in South Holland") +
+ theme(legend.background = element_rect(color = NA)) +
+ coord_sf()
Geospatial Data Carpentry for Urbanism
+ +Challenge 8: ð° 3 mins
Reveal.initialize({ 'controlsAuto': true, 'previewLinksAuto': false, -'smaller': false, 'pdfSeparateFragments': false, 'autoAnimateEasing': "ease", 'autoAnimateDuration': 1, 'autoAnimateUnmatched': true, -'menu': {"side":"left","useTextContentForMissingTitles":true,"markers":false,"loadIcons":false,"custom":[{"title":"Tools","icon":"","content":"- \n
- \n
Challenge 8: ð° 3 mins
tabsets.forEach(function(tabset) { const tabby = new Tabby('#' + tabset.id); }); + const isCodeAnnotation = (el) => { + for (const clz of el.classList) { + if (clz.startsWith('code-annotation-')) { + return true; + } + } + return false; + } const clipboard = new window.ClipboardJS('.code-copy-button', { - target: function(trigger) { - return trigger.previousElementSibling; + text: function(trigger) { + const codeEl = trigger.previousElementSibling.cloneNode(true); + for (const childEl of codeEl.children) { + if (isCodeAnnotation(childEl)) { + childEl.remove(); + } + } + return codeEl.innerText; } }); clipboard.on('success', function(e) { @@ -1040,10 +1254,9 @@Challenge 8: ð° 3 mins
// clear code selection e.clearSelection(); }); - function tippyHover(el, contentFn) { + function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) { const config = { allowHTML: true, - content: contentFn, maxWidth: 500, delay: 100, arrow: false, @@ -1052,9 +1265,18 @@Challenge 8: ð° 3 mins
}, interactive: true, interactiveBorder: 10, - theme: 'quarto-reveal', - placement: 'bottom-start' + theme: 'light-border', + placement: 'bottom-start', }; + if (contentFn) { + config.content = contentFn; + } + if (onTriggerFn) { + config.onTrigger = onTriggerFn; + } + if (onUntriggerFn) { + config.onUntrigger = onUntriggerFn; + } config['offset'] = [0,0]; config['maxWidth'] = 700; window.tippy(el, config); diff --git a/aio.html b/aio.html index 488d0bf1..4917abfc 100644 --- a/aio.html +++ b/aio.html @@ -2360,10 +2360,10 @@Objectives
Additional parameters, such as a definition of the centre of the map, are often necessary to create the full CRS. -In this workshop, we use two CRS shown in @tbl-crs.
+In this workshop, we use two CRS shown below.