diff --git a/08-intro-to-geospatial-concepts.html b/08-intro-to-geospatial-concepts.html index 0b6ded96..28591353 100644 --- a/08-intro-to-geospatial-concepts.html +++ b/08-intro-to-geospatial-concepts.html @@ -488,9 +488,9 @@

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.

    +reference systems @@ -560,7 +560,7 @@

    Challenge: CRS for calculating areas

    Main properties of WGS 84 and Amersfoort / RD New coordinate -reference systems {#tbl-crs}
    WGS 84 (EPSG:4326) Amersfoort / RD New (EPSG:28992)
    To best preserve 
use projections which are 

    angles between any two curvesconformal
    area or scaleequal-area (equivalent)
    distancesequal-distance (conventional)
    +
    lines_Delft <- st_read(here("episodes", "data", "delft-streets.shp"))
    +point_Delft <- st_read(here("episodes", "data", "delft-leisure.shp"))
    +
    +st_geometry_type(lines_Delft)
    +st_geometry_type(point_Delft)
    +
    +st_crs(lines_Delft)
    +st_crs(point_Delft)
    +
    +st_bbox(lines_Delft)
    +st_bbox(point_Delft)
    @@ -476,7 +675,7 @@

    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.

    1. How many attributes does each have?
    2. @@ -487,7 +686,7 @@

      Challenge 2: 🕐 3 mins

      ⁣        A) location B) leisure C) osm_id

      -
      +
      03:00
      @@ -497,20 +696,20 @@

      Challenge 2: 🕐 3 mins

      -
      ncol(point_Delft)
      -ncol(boundary_Delft)
      -
      -head(point_Delft)
      -head(point_Delft, 10)
      -
      -point_Delft
      -
      -names(point_Delft)
      +
      ncol(point_Delft)
      +ncol(boundary_Delft)
      +
      +head(point_Delft)
      +head(point_Delft, 10)
      +
      +point_Delft
      +
      +names(point_Delft)
    -

    Challenge 3: 🕢 5 mins

    +

    Challenge 3: 5 mins

    1. Create a new object that only contains the motorways in Delft.
    2. How many features does the new object have?
    3. @@ -520,7 +719,7 @@

      Challenge 3: 🕢 5 mins

    -
    +
    05:00
    @@ -528,27 +727,27 @@

    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:

    -
    +
    03:00
    @@ -567,21 +766,21 @@

    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:

    -
    +
    05:00
    @@ -598,21 +797,21 @@

    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:

    -
    +
    03:00
    @@ -629,14 +828,14 @@

    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()
    @@ -646,7 +845,7 @@

    Plot multiple shapefiles

    -

    Challenge 7: 🕘 5 mins

    +

    Challenge 7: 5 mins

    Create a map of leisure locations only including playground and picnic_table:

    -
    +
    05:00
    @@ -664,24 +863,24 @@

    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))
    @@ -691,7 +890,7 @@

    Handling spatial projections

    -

    Challenge 8: 🕰 3 mins

    +

    Challenge 8: 3 mins

    Create a map of the South Holland, as follows:

    1. Import nl-gemeenten.shp and filter only the municipalities in South Holland.
    2. @@ -702,7 +901,7 @@

      Challenge 8: 🕰 3 mins

    -
    +
    03:00
    @@ -710,20 +909,22 @@

    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()
    +
    @@ -754,12 +955,11 @@

    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":""}],"openButton":true}, +'menu': {"side":"left","useTextContentForMissingTitles":true,"markers":false,"loadIcons":false,"custom":[{"title":"Tools","icon":"","content":""}],"openButton":true}, 'chalkboard': {"buttons":true}, 'smaller': false, @@ -1002,9 +1202,23 @@

    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.

    +reference systems@@ -2470,7 +2470,7 @@

    Challenge: CRS for calculating areas

    Main properties of WGS 84 and Amersfoort / RD New coordinate -reference systems {#tbl-crs}
    Main properties of WGS 84 and Amersfoort / RD New coordinate -reference systems {#tbl-crs}
    WGS 84 (EPSG:4326) Amersfoort / RD New (EPSG:28992)
    Main properties of WGS 84 and Amersfoort / RD New coordinate -reference systems {#tbl-crs}