From a3aef162b7acea46682ca5102f128db4aa20f743 Mon Sep 17 00:00:00 2001 From: almac2022 Date: Fri, 15 Nov 2024 16:43:32 -0800 Subject: [PATCH] fix the screenshots --- .../index/execute-results/html.json | 4 +- .../airphotos_1968-05-09_1968-07-31.csv | 54 ------------------ .../fig/Screenshot1.png | Bin .../fig/Screenshot2.png | Bin .../index.qmd | 10 +++- 5 files changed, 9 insertions(+), 59 deletions(-) delete mode 100644 posts/2024-11-15-bcdata-ortho-historic/exports/airphotos_1968-05-09_1968-07-31.csv rename "posts/2024-11-15-bcdata-ortho-historic/fig/Screenshot 2024-11-15 at 2.03.42\342\200\257PM.png" => posts/2024-11-15-bcdata-ortho-historic/fig/Screenshot1.png (100%) rename "posts/2024-11-15-bcdata-ortho-historic/fig/Screenshot 2024-11-15 at 2.41.57\342\200\257PM.png" => posts/2024-11-15-bcdata-ortho-historic/fig/Screenshot2.png (100%) diff --git a/_freeze/posts/2024-11-15-bcdata-ortho-historic/index/execute-results/html.json b/_freeze/posts/2024-11-15-bcdata-ortho-historic/index/execute-results/html.json index 61b1883..ac0ab14 100644 --- a/_freeze/posts/2024-11-15-bcdata-ortho-historic/index/execute-results/html.json +++ b/_freeze/posts/2024-11-15-bcdata-ortho-historic/index/execute-results/html.json @@ -1,8 +1,8 @@ { - "hash": "7c3a62654bdc0b099774b5f39801e716", + "hash": "3ae8cf90e00a8ff3848917feb8e050a6", "result": { "engine": "knitr", - "markdown": "---\ntitle: \"Getting details of historic orthophoto imagery with R\"\nauthor: \"al\"\ndate: \"2024-11-15\"\ndate-modified: \"2024-11-15\"\ncategories: [fwapg, r, bcdata]\nimage: \"image.jpg\"\nparams:\n repo_owner: \"NewGraphEnvironment\"\n repo_name: \"new_graphiti\"\n post_name: \"2024-11-15-bcdata-ortho-historic\"\nformat: \n html:\n code-fold: true\n---\n\n\nWe need some historic ortho photo imagery so that we can have a look at historic watershed conditions compared to current. First thing we're gonna do is generate a area of interest for which we want all of the map sheets ideas for.\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nsuppressMessages(library(tidyverse))\nlibrary(ggplot2)\nlibrary(bcdata)\nlibrary(fwapgr)\nsuppressMessages(library(sf))\n# library(leaflet)\n# library(leafem)```\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\npath_post <- fs::path(\n here::here(),\n \"posts\",\n params$post_name\n)\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nstaticimports::import(\n dir = fs::path(\n path_post,\n \"scripts\"\n ),\n outfile = fs::path(\n path_post,\n \"scripts\",\n \"staticimports\",\n ext = \"R\"\n )\n)\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nsource(\n fs::path(\n path_post,\n \"scripts\",\n \"staticimports\",\n ext = \"R\"\n )\n)\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# lets build a custom watersehed just for upstream of the confluence of Neexdzii Kwa and Wetzin Kwa\n# blueline key\nblk <- 360873822\n# downstream route measure\ndrm <- 166030.4\n\naoi <- fwapgr::fwa_watershed_at_measure(blue_line_key = blk, \n downstream_route_measure = drm) |> \n sf::st_transform(4326)\n\n#get the bounding box of our aoi\n# aoi_bb <- sf::st_bbox(aoi)\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# grab all the railways\nl_rail <- rfp::rfp_bcd_get_data(\n bcdata_record_id = \"whse_basemapping.gba_railway_tracks_sp\"\n) |> \n sf::st_transform(4326) |> \n janitor::clean_names() \n\n\n# streams in the bulkley and then filter to just keep the big ones\nl_streams <- rfp::rfp_bcd_get_data(\n bcdata_record_id = \"whse_basemapping.fwa_stream_networks_sp\",\n col_filter = \"watershed_group_code\",\n col_filter_value = \"BULK\",\n # grab a smaller object by including less columns\n col_extract = c(\"linear_feature_id\", \"stream_order\", \"gnis_name\", \"downstream_route_measure\", \"blue_line_key\", \"length_metre\")\n) |> \n sf::st_transform(4326) |> \n janitor::clean_names() |> \n dplyr::filter(stream_order > 4)\n\n# historic orthophotos\n# WHSE_IMAGERY_AND_BASE_MAPS.AIMG_HIST_INDEX_MAPS_POLY\n#https://catalogue.data.gov.bc.ca/dataset/airborne-imagery-historical-index-map-points\nl_imagery <- rfp::rfp_bcd_get_data(\n bcdata_record_id = \"WHSE_IMAGERY_AND_BASE_MAPS.AIMG_ORTHOPHOTO_TILES_POLY\") |> \n sf::st_transform(4326) |> \n janitor::clean_names()\n\nl_imagery_hist <- rfp::rfp_bcd_get_data(\n bcdata_record_id = \"WHSE_IMAGERY_AND_BASE_MAPS.AIMG_HIST_INDEX_MAPS_POINT\") |> \n sf::st_transform(4326) |> \n janitor::clean_names()\n\nl_imagery_grid <- rfp::rfp_bcd_get_data(\n bcdata_record_id = \"WHSE_BASEMAPPING.NTS_50K_GRID\") |> \n sf::st_transform(4326) |> \n janitor::clean_names()\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# get a list of the objects in our env that start with l_\nls <- ls()[stringr::str_starts(ls(), \"l_\")] \n\nlayers_to_trim <- tibble::lst(\n !!!mget(ls)\n)\n\n\n# Function to validate and repair geometries\nvalidate_geometries <- function(layer) {\n layer <- sf::st_make_valid(layer)\n layer <- layer[sf::st_is_valid(layer), ]\n return(layer)\n}\n\n# Apply validation to the AOI and layers\naoi <- validate_geometries(aoi)\nlayers_to_trim <- purrr::map(layers_to_trim, validate_geometries)\n\n# clip them with purrr and sf\nlayers_trimmed <- purrr::map(\n layers_to_trim,\n ~ sf::st_intersection(.x, aoi)\n) \n```\n:::\n\nOK, so it looks like we cannot get historical air photo information from layers downloaded from BC data catalogue because the majority of the photos are not referenced. It does however seem that if we go through the online interface, we can use a NTS 1 to 50,000 map sheet to export a CSV file that does contain information about individual air photo locations. Our study area is huge so to begin with let's just have a look at the area from Macquarie Creek up to a boat the location of Talley. For this area we just have 21 to 50,000 map sheets. We can visualize which map she's those are by downloading that map sheet layer from BC data catalogue overlay it on our general study area.\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmap <- ggplot() +\n # tidyterra::geom_spatraster(\n # data = as.factor(land_cover_raster_resampled),\n # use_coltab = TRUE,\n # maxcell = Inf\n # ) +\n geom_sf(\n data = aoi,\n fill = \"transparent\",\n color = \"black\",\n linewidth = .5\n ) +\n geom_sf(\n data = layers_trimmed$l_streams,\n color = \"blue\",\n size = 1\n ) +\n geom_sf(\n data = layers_trimmed$l_rail,\n color = \"black\",\n size = 1\n ) +\n # geom_sf(\n # data = layers_trimmed$l_imagery_hist,\n # color = \"red\",\n # size = 1\n # ) +\n geom_sf(\n data = layers_trimmed$l_imagery_grid,\n alpha = 0.25,\n ) +\n geom_sf_text(\n data = layers_trimmed$l_imagery_grid,\n aes(label = map_tile),\n size = 3 # Adjust size of the text labels as needed\n )\n # ggdark::dark_theme_void()\n\n\nmap\n```\n\n::: {.cell-output-display}\n![](index_files/figure-html/unnamed-chunk-4-1.png){width=672}\n:::\n:::\n\n\n\nSo looks like we have map sheet 093L09 as well as 0 93L08. Next, we're gonna go into the provincial [WIMSI9](https://www2.gov.bc.ca/gov/content/data/geographic-data-services/digital-imagery/air-photos) service and manually select our NTS grids, state the date range we would like to search and export. We chose the following options:\n\n - Years from: 1963 to 1980\n\nIt looks like this.\n\n\n::: {.cell}\n\n```{.r .cell-code}\nknitr::include_graphics(fs::path(\n path_post,\n \"fig/Screenshot 2024-11-15 at 2.03.42 PM\",\n ext = \"png\"\n )\n)\n```\n\n::: {.cell-output-display}\n![](fig/Screenshot 2024-11-15 at 2.03.42 PM.png){width=743}\n:::\n:::\n\n\nLet's read in what we have, turn into spatial object, trim to overall study area and plot\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# list csvs\n\nls <- fs::dir_ls(\n fs::path(\n path_post,\n \"data\"),\n glob = \"*.csv\"\n)\n\nphotos_raw <- ls |> \n purrr::map_df(\n readr::read_csv\n ) |> \n sf::st_as_sf(\n coords = c(\"Longitude\", \"Latitude\"), crs = 4326\n ) |> \n janitor::clean_names() |> \n dplyr::mutate(photo_date = lubridate::mdy(photo_date)) \n\nphotos_aoi <- sf::st_intersection(photos_raw, aoi)\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nmap +\n geom_sf(\n data = photos_aoi,\n alpha = 0.25,\n ) \n```\n\n::: {.cell-output-display}\n![](index_files/figure-html/map2-1.png){width=672}\n:::\n\n```{.r .cell-code}\n # geom_sf_text(\n # data = photos_aoi,\n # aes(\n # label = \n # paste(\n # # roll_frame_series,\n # frame,\n # sep = \"-\"\n # )\n # ),\n # size = 2 # Adjust size of the text labels as needed\n # )\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nbuffer <- 3000\ndrm <- 263795\n```\n:::\n\n\n\nOk - so let's say we only want the ones that are within say 3000 of either side of the Bulkley River mainstem.\n\n\nLet's grab just the mainstem segments up to the top end of Bulkley Lake, merge, buffer the stream and clip our airphoto list by that.\n\nWe can use the `downstream_route_measure` of the stream layer to exclude areas upstream of Bulkley Lake (also known as Taman Creek). It looks like this in QGIS\n\n\n::: {.cell}\n\n```{.r .cell-code}\nknitr::include_graphics(fs::path(\n path_post,\n \"fig/Screenshot 2024-11-15 at 2.41.57 PM\",\n ext = \"png\"\n )\n)\n```\n\n::: {.cell-output-display}\n![](fig/Screenshot 2024-11-15 at 2.41.57 PM.png){width=946}\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\naoi_refined_raw <- layers_trimmed$l_streams |> \n dplyr::filter(gnis_name == \"Bulkley River\" & downstream_route_measure < drm) |> \n # dplyr::arrange(downstream_route_measure) |>\n # calculate when we get to length_m by adding up the length_metre field and filtering out everything up to length_m\n # dplyr::filter(cumsum(length_metre) <= length_m) |>\n sf::st_union()\n\n\naoi_refined_buffered <- sf::st_buffer(\n # we need to run st_sf or we get a sp object in a list...\n sf::st_sf(\n aoi_refined_raw\n ), \n buffer, endCapStyle = \"FLAT\"\n) \n\nphotos_aoi_refined <- sf::st_intersection(photos_raw, aoi_refined_buffered)\n```\n:::\n\n\nok lets plot again\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmap +\n geom_sf(\n data = photos_aoi_refined,\n alpha = 0.25,\n ) \n```\n\n::: {.cell-output-display}\n![](index_files/figure-html/map3-1.png){width=672}\n:::\n:::\n\nNow lets filter by date to see what we can get for the earliest photos possible. What is our range:\n\n\n::: {.cell}\n\n```{.r .cell-code}\nrange(photos_aoi_refined$photo_date)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n[1] \"1968-05-09\" \"1980-09-07\"\n```\n\n\n:::\n:::\n\n\nWhat do we have for photos before 1970\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmap +\n geom_sf(\n data = photos_aoi_refined |> dplyr::filter(photo_date <= \"1969-12-31\"),\n alpha = 0.25,\n ) \n```\n\n::: {.cell-output-display}\n![](index_files/figure-html/map4-1.png){width=672}\n:::\n:::\n\nLooks like decent coverage so lets go with that.\n\n\n::: {.cell}\n\n```{.r .cell-code}\nphotos <- photos_aoi_refined |> \n dplyr::filter(photo_date <= \"1969-12-31\")\n\nphotos |> \n my_dt_table(cols_freeze_left = 2)\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n\n```\n\n:::\n:::\n\n\nThere are 104 photos. Let's burn out a csv that can be used to find them.\n\n\n::: {.cell}\n\n```{.r .cell-code}\npath_output <- fs::path(\n path_post,\n \"exports\",\n paste(\n \"airphotos\",\n paste(range(photos$photo_date), collapse = \"_\"),\n sep = \"_\"\n ),\n ext = \"csv\"\n )\n\nphotos |> \n readr::write_csv(\n path_output, na =\"\"\n )\n```\n:::\n\n\n\nWe can view and download this file [here](https://github.com/NewGraphEnvironment/new_graphiti/tree/main/posts/2024-11-15-bcdata-ortho-historic/exports/airphotos_1968-05-09_1968-07-31.csv)\n\n\n::: {.cell}\n\n```{.r .cell-code}\n leaflet::leaflet() |>\n leaflet::addTiles() |>\n leafem:::addCOG(\n url = url\n , group = \"COG\"\n , resolution = 512\n , autozoom = TRUE\n )\n```\n:::\n", + "markdown": "---\ntitle: \"Getting details of historic orthophoto imagery with R\"\nauthor: \"al\"\ndate: \"2024-11-15\"\ndate-modified: \"2024-11-15\"\ncategories: [fwapg, r, bcdata]\nimage: \"image.jpg\"\nparams:\n repo_owner: \"NewGraphEnvironment\"\n repo_name: \"new_graphiti\"\n post_name: \"2024-11-15-bcdata-ortho-historic\"\nformat: \n html:\n code-fold: true\n---\n\n\nWe need some historic ortho photo imagery so that we can have a look at historic watershed conditions compared to current. First thing we're gonna do is generate a area of interest for which we want all of the map sheets ideas for.\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nsuppressMessages(library(tidyverse))\nlibrary(ggplot2)\nlibrary(bcdata)\nlibrary(fwapgr)\nsuppressMessages(library(sf))\n# library(leaflet)\n# library(leafem)```\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\npath_post <- fs::path(\n here::here(),\n \"posts\",\n params$post_name\n)\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nstaticimports::import(\n dir = fs::path(\n path_post,\n \"scripts\"\n ),\n outfile = fs::path(\n path_post,\n \"scripts\",\n \"staticimports\",\n ext = \"R\"\n )\n)\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nsource(\n fs::path(\n path_post,\n \"scripts\",\n \"staticimports\",\n ext = \"R\"\n )\n)\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# lets build a custom watersehed just for upstream of the confluence of Neexdzii Kwa and Wetzin Kwa\n# blueline key\nblk <- 360873822\n# downstream route measure\ndrm <- 166030.4\n\naoi <- fwapgr::fwa_watershed_at_measure(blue_line_key = blk, \n downstream_route_measure = drm) |> \n sf::st_transform(4326)\n\n#get the bounding box of our aoi\n# aoi_bb <- sf::st_bbox(aoi)\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# grab all the railways\nl_rail <- rfp::rfp_bcd_get_data(\n bcdata_record_id = \"whse_basemapping.gba_railway_tracks_sp\"\n) |> \n sf::st_transform(4326) |> \n janitor::clean_names() \n\n\n# streams in the bulkley and then filter to just keep the big ones\nl_streams <- rfp::rfp_bcd_get_data(\n bcdata_record_id = \"whse_basemapping.fwa_stream_networks_sp\",\n col_filter = \"watershed_group_code\",\n col_filter_value = \"BULK\",\n # grab a smaller object by including less columns\n col_extract = c(\"linear_feature_id\", \"stream_order\", \"gnis_name\", \"downstream_route_measure\", \"blue_line_key\", \"length_metre\")\n) |> \n sf::st_transform(4326) |> \n janitor::clean_names() |> \n dplyr::filter(stream_order > 4)\n\n# historic orthophotos\n# WHSE_IMAGERY_AND_BASE_MAPS.AIMG_HIST_INDEX_MAPS_POLY\n#https://catalogue.data.gov.bc.ca/dataset/airborne-imagery-historical-index-map-points\nl_imagery <- rfp::rfp_bcd_get_data(\n bcdata_record_id = \"WHSE_IMAGERY_AND_BASE_MAPS.AIMG_ORTHOPHOTO_TILES_POLY\") |> \n sf::st_transform(4326) |> \n janitor::clean_names()\n\nl_imagery_hist <- rfp::rfp_bcd_get_data(\n bcdata_record_id = \"WHSE_IMAGERY_AND_BASE_MAPS.AIMG_HIST_INDEX_MAPS_POINT\") |> \n sf::st_transform(4326) |> \n janitor::clean_names()\n\nl_imagery_grid <- rfp::rfp_bcd_get_data(\n bcdata_record_id = \"WHSE_BASEMAPPING.NTS_50K_GRID\") |> \n sf::st_transform(4326) |> \n janitor::clean_names()\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# get a list of the objects in our env that start with l_\nls <- ls()[stringr::str_starts(ls(), \"l_\")] \n\nlayers_to_trim <- tibble::lst(\n !!!mget(ls)\n)\n\n\n# Function to validate and repair geometries\nvalidate_geometries <- function(layer) {\n layer <- sf::st_make_valid(layer)\n layer <- layer[sf::st_is_valid(layer), ]\n return(layer)\n}\n\n# Apply validation to the AOI and layers\naoi <- validate_geometries(aoi)\nlayers_to_trim <- purrr::map(layers_to_trim, validate_geometries)\n\n# clip them with purrr and sf\nlayers_trimmed <- purrr::map(\n layers_to_trim,\n ~ sf::st_intersection(.x, aoi)\n) \n```\n:::\n\nOK, so it looks like we cannot get historical air photo information from layers downloaded from BC data catalogue because the majority of the photos are not referenced. It does however seem that if we go through the online interface, we can use a NTS 1 to 50,000 map sheet to export a CSV file that does contain information about individual air photo locations. Our study area is huge so to begin with let's just have a look at the area from Macquarie Creek up to a boat the location of Talley. For this area we just have 21 to 50,000 map sheets. We can visualize which map she's those are by downloading that map sheet layer from BC data catalogue overlay it on our general study area.\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmap <- ggplot() +\n # tidyterra::geom_spatraster(\n # data = as.factor(land_cover_raster_resampled),\n # use_coltab = TRUE,\n # maxcell = Inf\n # ) +\n geom_sf(\n data = aoi,\n fill = \"transparent\",\n color = \"black\",\n linewidth = .5\n ) +\n geom_sf(\n data = layers_trimmed$l_streams,\n color = \"blue\",\n size = 1\n ) +\n geom_sf(\n data = layers_trimmed$l_rail,\n color = \"black\",\n size = 1\n ) +\n # geom_sf(\n # data = layers_trimmed$l_imagery_hist,\n # color = \"red\",\n # size = 1\n # ) +\n geom_sf(\n data = layers_trimmed$l_imagery_grid,\n alpha = 0.25,\n ) +\n geom_sf_text(\n data = layers_trimmed$l_imagery_grid,\n aes(label = map_tile),\n size = 3 # Adjust size of the text labels as needed\n )\n # ggdark::dark_theme_void()\n\n\nmap\n```\n\n::: {.cell-output-display}\n![](index_files/figure-html/unnamed-chunk-4-1.png){width=672}\n:::\n:::\n\n\n\nSo looks like we have map sheet 093L09 as well as 0 93L08. Next, we're gonna go into the provincial [WIMSI9](https://www2.gov.bc.ca/gov/content/data/geographic-data-services/digital-imagery/air-photos) service and manually select our NTS grids, state the date range we would like to search and export. We chose the following options:\n\n - Years from: 1963 to 1980\n\nIt looks like this.\n\n\n::: {.cell}\n\n```{.r .cell-code}\nknitr::include_graphics(fs::path(\n path_post,\n \"fig\",\n \"Screenshot1\",\n ext = \"png\"\n )\n)\n```\n\n::: {.cell-output-display}\n![](fig/Screenshot1.png){width=743}\n:::\n\n```{.r .cell-code}\n# knitr::include_graphics(\"fig/Screenshot 2024-11-15 at 2.03.42 PM.png\")\n```\n:::\n\n\nLet's read in what we have, turn into spatial object, trim to overall study area and plot\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# list csvs\n\nls <- fs::dir_ls(\n fs::path(\n path_post,\n \"data\"),\n glob = \"*.csv\"\n)\n\nphotos_raw <- ls |> \n purrr::map_df(\n readr::read_csv\n ) |> \n sf::st_as_sf(\n coords = c(\"Longitude\", \"Latitude\"), crs = 4326\n ) |> \n janitor::clean_names() |> \n dplyr::mutate(photo_date = lubridate::mdy(photo_date)) \n\nphotos_aoi <- sf::st_intersection(photos_raw, aoi)\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nmap +\n geom_sf(\n data = photos_aoi,\n alpha = 0.25,\n ) \n```\n\n::: {.cell-output-display}\n![](index_files/figure-html/map2-1.png){width=672}\n:::\n\n```{.r .cell-code}\n # geom_sf_text(\n # data = photos_aoi,\n # aes(\n # label = \n # paste(\n # # roll_frame_series,\n # frame,\n # sep = \"-\"\n # )\n # ),\n # size = 2 # Adjust size of the text labels as needed\n # )\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nbuffer <- 3000\ndrm <- 263795\n```\n:::\n\n\n\nOk - so let's say we only want the ones that are within say 3000 of either side of the Bulkley River mainstem.\n\n\nLet's grab just the mainstem segments up to the top end of Bulkley Lake, merge, buffer the stream and clip our airphoto list by that.\n\nWe can use the `downstream_route_measure` of the stream layer to exclude areas upstream of Bulkley Lake (also known as Taman Creek). It looks like this in QGIS\n\n\n::: {.cell}\n\n```{.r .cell-code}\nknitr::include_graphics(fs::path(\n path_post,\n \"fig\",\n \"Screenshot2\",\n ext = \"png\"\n )\n)\n```\n\n::: {.cell-output-display}\n![](fig/Screenshot2.png){width=946}\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\naoi_refined_raw <- layers_trimmed$l_streams |> \n dplyr::filter(gnis_name == \"Bulkley River\" & downstream_route_measure < drm) |> \n # dplyr::arrange(downstream_route_measure) |>\n # calculate when we get to length_m by adding up the length_metre field and filtering out everything up to length_m\n # dplyr::filter(cumsum(length_metre) <= length_m) |>\n sf::st_union()\n\n\naoi_refined_buffered <- sf::st_buffer(\n # we need to run st_sf or we get a sp object in a list...\n sf::st_sf(\n aoi_refined_raw\n ), \n buffer, endCapStyle = \"FLAT\"\n) \n\nphotos_aoi_refined <- sf::st_intersection(photos_raw, aoi_refined_buffered)\n```\n:::\n\n\nok lets plot again\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmap +\n geom_sf(\n data = photos_aoi_refined,\n alpha = 0.25,\n ) \n```\n\n::: {.cell-output-display}\n![](index_files/figure-html/map3-1.png){width=672}\n:::\n:::\n\nNow lets filter by date to see what we can get for the earliest photos possible. What is our range:\n\n\n::: {.cell}\n\n```{.r .cell-code}\nrange(photos_aoi_refined$photo_date)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n[1] \"1968-05-09\" \"1980-09-07\"\n```\n\n\n:::\n:::\n\n\nWhat do we have for photos before 1970\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmap +\n geom_sf(\n data = photos_aoi_refined |> dplyr::filter(photo_date <= \"1969-12-31\"),\n alpha = 0.25,\n ) \n```\n\n::: {.cell-output-display}\n![](index_files/figure-html/map4-1.png){width=672}\n:::\n:::\n\nLooks like decent coverage so lets go with that.\n\n\n::: {.cell}\n\n```{.r .cell-code}\nphotos <- photos_aoi_refined |> \n dplyr::filter(photo_date <= \"1969-12-31\")\n\nphotos |> \n my_dt_table(cols_freeze_left = 2)\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n\n```\n\n:::\n:::\n\n\nThere are 104 photos. Let's burn out a csv that can be used to find them.\n\n\n::: {.cell}\n\n```{.r .cell-code}\npath_output <- fs::path(\n path_post,\n \"exports\",\n paste(\n \"airphotos\",\n paste(range(photos$photo_date), collapse = \"_\"),\n sep = \"_\"\n ),\n ext = \"csv\"\n )\n\nphotos |> \n readr::write_csv(\n path_output, na =\"\"\n )\n```\n:::\n\n\n\nWe can view and download exported csv file [here](https://github.com/NewGraphEnvironment/new_graphiti/tree/main/posts/2024-11-15-bcdata-ortho-historic/exports/)\n\n\n::: {.cell}\n\n```{.r .cell-code}\n leaflet::leaflet() |>\n leaflet::addTiles() |>\n leafem:::addCOG(\n url = url\n , group = \"COG\"\n , resolution = 512\n , autozoom = TRUE\n )\n```\n:::\n", "supporting": [ "index_files" ], diff --git a/posts/2024-11-15-bcdata-ortho-historic/exports/airphotos_1968-05-09_1968-07-31.csv b/posts/2024-11-15-bcdata-ortho-historic/exports/airphotos_1968-05-09_1968-07-31.csv deleted file mode 100644 index 0fc43c6..0000000 --- a/posts/2024-11-15-bcdata-ortho-historic/exports/airphotos_1968-05-09_1968-07-31.csv +++ /dev/null @@ -1,54 +0,0 @@ -roll_frame_series,frame,media,photo_date,photo_time,scale,focal_length_mm,operation_tag,bcgs_mapsheet,nts_mapsheet,georeferenced,thumbnail_image,geometry -bc5281,97,Film - BW,1968-05-09,12:30:00,,153,B-012-AF-68,093l05021,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5281/bc5281_097_thumb.jpg,"c(-126.0581, 54.4025)" -bc5282,209,Film - BW,1968-05-10,10:21:00,01:12:00,153,B-022-WR-68,093l04843,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5282/bc5282_209_thumb.jpg,"c(-126.4971, 54.49597)" -bc5282,220,Film - BW,1968-05-10,10:28:00,01:12:00,153,B-022-WR-68,093l04843,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5282/bc5282_220_thumb.jpg,"c(-126.4748, 54.48242)" -bc5282,221,Film - BW,1968-05-10,10:28:00,01:12:00,153,B-022-WR-68,093l04843,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5282/bc5282_221_thumb.jpg,"c(-126.4879, 54.47635)" -bc5283,38,Film - BW,1968-05-10,10:57:00,01:12:00,153,B-022-WR-68,093l04943,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_038_thumb.jpg,"c(-126.2893, 54.49375)" -bc5283,39,Film - BW,1968-05-10,10:57:00,01:12:00,153,B-022-WR-68,093l04943,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_039_thumb.jpg,"c(-126.28, 54.48599)" -bc5283,40,Film - BW,1968-05-10,10:57:00,01:12:00,153,B-022-WR-68,093l04943,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_040_thumb.jpg,"c(-126.2706, 54.47824)" -bc5283,41,Film - BW,1968-05-10,10:57:00,01:12:00,153,B-022-WR-68,093l04941,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_041_thumb.jpg,"c(-126.2613, 54.47049)" -bc5283,42,Film - BW,1968-05-10,10:57:00,01:12:00,153,B-022-WR-68,093l04941,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_042_thumb.jpg,"c(-126.2519, 54.46274)" -bc5283,43,Film - BW,1968-05-10,10:57:00,01:12:00,153,B-022-WR-68,093l04942,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_043_thumb.jpg,"c(-126.2425, 54.45499)" -bc5283,44,Film - BW,1968-05-10,10:57:00,01:12:00,153,B-022-WR-68,093l04924,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_044_thumb.jpg,"c(-126.2332, 54.44723)" -bc5283,45,Film - BW,1968-05-10,10:57:00,01:12:00,153,B-022-WR-68,093l04924,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_045_thumb.jpg,"c(-126.2238, 54.43948)" -bc5283,46,Film - BW,1968-05-10,10:57:00,01:12:00,153,B-022-WR-68,093l04924,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_046_thumb.jpg,"c(-126.2145, 54.43173)" -bc5283,47,Film - BW,1968-05-10,10:57:00,01:12:00,153,B-022-WR-68,093l04922,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_047_thumb.jpg,"c(-126.2056, 54.42443)" -bc5283,48,Film - BW,1968-05-10,10:57:00,01:12:00,153,B-022-WR-68,093l05011,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_048_thumb.jpg,"c(-126.1968, 54.41712)" -bc5283,49,Film - BW,1968-05-10,10:57:00,01:12:00,153,B-022-WR-68,093l05011,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_049_thumb.jpg,"c(-126.188, 54.40982)" -bc5283,50,Film - BW,1968-05-10,10:57:00,01:12:00,153,B-022-WR-68,093l05011,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_050_thumb.jpg,"c(-126.1792, 54.40252)" -bc5283,51,Film - BW,1968-05-10,10:57:00,01:12:00,153,B-022-WR-68,093l04033,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_051_thumb.jpg,"c(-126.1703, 54.39522)" -bc5283,52,Film - BW,1968-05-10,10:57:00,01:12:00,153,B-022-WR-68,093l04033,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_052_thumb.jpg,"c(-126.1615, 54.38791)" -bc5283,53,Film - BW,1968-05-10,10:57:00,01:12:00,153,B-022-WR-68,093l04033,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_053_thumb.jpg,"c(-126.1527, 54.38061)" -bc5283,58,Film - BW,1968-05-10,11:04:00,01:12:00,153,B-022-WR-68,093l04032,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_058_thumb.jpg,"c(-126.1026, 54.37398)" -bc5283,59,Film - BW,1968-05-10,11:04:00,01:12:00,153,B-022-WR-68,093l04034,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_059_thumb.jpg,"c(-126.1118, 54.38132)" -bc5283,60,Film - BW,1968-05-10,11:04:00,01:12:00,153,B-022-WR-68,093l04034,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_060_thumb.jpg,"c(-126.1211, 54.38866)" -bc5283,61,Film - BW,1968-05-10,11:04:00,01:12:00,153,B-022-WR-68,093l04034,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_061_thumb.jpg,"c(-126.1303, 54.39599)" -bc5283,67,Film - BW,1968-05-10,11:04:00,01:12:00,153,B-022-WR-68,093l05013,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_067_thumb.jpg,"c(-126.1858, 54.44002)" -bc5283,68,Film - BW,1968-05-10,11:04:00,01:12:00,153,B-022-WR-68,093l05013,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_068_thumb.jpg,"c(-126.1935, 54.44676)" -bc5283,69,Film - BW,1968-05-10,11:04:00,01:12:00,153,B-022-WR-68,093l04942,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_069_thumb.jpg,"c(-126.2012, 54.4535)" -bc5283,74,Film - BW,1968-05-10,11:04:00,01:12:00,153,B-022-WR-68,093l04944,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_074_thumb.jpg,"c(-126.2398, 54.48722)" -bc5296,235,Film - BW,1968-07-24,09:01:00,,153,B-012-AF-68,093l04924,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5296/bc5296_235_thumb.jpg,"c(-126.2127, 54.44108)" -bc5296,236,Film - BW,1968-07-24,09:01:00,,153,B-012-AF-68,093l04922,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5296/bc5296_236_thumb.jpg,"c(-126.2122, 54.41353)" -bc5300,152,Film - BW,1968-07-31,09:18:00,,153,B-012-AF-68,093l04943,093L08,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5300/bc5300_152_thumb.jpg,"c(-126.2941, 54.49532)" -bc5282,210,Film - BW,1968-05-10,10:21:00,01:12:00,153,B-022-WR-68,093l05821,093L09,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5282/bc5282_210_thumb.jpg,"c(-126.4842, 54.50195)" -bc5282,211,Film - BW,1968-05-10,10:21:00,01:12:00,153,B-022-WR-68,093l05821,093L09,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5282/bc5282_211_thumb.jpg,"c(-126.4713, 54.50792)" -bc5282,212,Film - BW,1968-05-10,10:21:00,01:12:00,153,B-022-WR-68,093l05821,093L09,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5282/bc5282_212_thumb.jpg,"c(-126.4584, 54.51389)" -bc5282,213,Film - BW,1968-05-10,10:25:00,01:12:00,153,B-022-WR-68,093l05822,093L09,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5282/bc5282_213_thumb.jpg,"c(-126.4455, 54.51987)" -bc5282,214,Film - BW,1968-05-10,10:28:00,01:12:00,153,B-022-WR-68,093l05911,093L09,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5282/bc5282_214_thumb.jpg,"c(-126.3966, 54.51887)" -bc5282,215,Film - BW,1968-05-10,10:28:00,01:12:00,153,B-022-WR-68,093l05822,093L09,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5282/bc5282_215_thumb.jpg,"c(-126.4096, 54.51279)" -bc5282,216,Film - BW,1968-05-10,10:28:00,01:12:00,153,B-022-WR-68,093l05822,093L09,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5282/bc5282_216_thumb.jpg,"c(-126.4227, 54.50672)" -bc5283,7,Film - BW,1968-05-10,10:44:00,01:12:00,153,B-022-WR-68,093l05912,093L09,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_007_thumb.jpg,"c(-126.3102, 54.5135)" -bc5283,8,Film - BW,1968-05-10,10:44:00,01:12:00,153,B-022-WR-68,093l05912,093L09,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_008_thumb.jpg,"c(-126.3254, 54.51414)" -bc5283,9,Film - BW,1968-05-10,10:44:00,01:12:00,153,B-022-WR-68,093l05912,093L09,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_009_thumb.jpg,"c(-126.3406, 54.51478)" -bc5283,10,Film - BW,1968-05-10,10:44:00,01:12:00,153,B-022-WR-68,093l05911,093L09,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_010_thumb.jpg,"c(-126.3558, 54.51542)" -bc5283,11,Film - BW,1968-05-10,10:44:00,01:12:00,153,B-022-WR-68,093l05911,093L09,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_011_thumb.jpg,"c(-126.3727, 54.51585)" -bc5283,12,Film - BW,1968-05-10,10:44:00,01:12:00,153,B-022-WR-68,093l05911,093L09,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_012_thumb.jpg,"c(-126.3897, 54.51628)" -bc5283,13,Film - BW,1968-05-10,10:44:00,01:12:00,153,B-022-WR-68,093l05822,093L09,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_013_thumb.jpg,"c(-126.4067, 54.51671)" -bc5283,14,Film - BW,1968-05-10,10:44:00,01:12:00,153,B-022-WR-68,093l05822,093L09,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_014_thumb.jpg,"c(-126.4236, 54.51715)" -bc5283,15,Film - BW,1968-05-10,10:44:00,01:12:00,153,B-022-WR-68,093l05822,093L09,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_015_thumb.jpg,"c(-126.4406, 54.51758)" -bc5283,16,Film - BW,1968-05-10,10:44:00,01:12:00,153,B-022-WR-68,093l05821,093L09,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_016_thumb.jpg,"c(-126.4576, 54.51801)" -bc5283,17,Film - BW,1968-05-10,10:44:00,01:12:00,153,B-022-WR-68,093l05821,093L09,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_017_thumb.jpg,"c(-126.4745, 54.51844)" -bc5283,36,Film - BW,1968-05-10,10:57:00,01:12:00,153,B-022-WR-68,093l05912,093L09,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_036_thumb.jpg,"c(-126.308, 54.50925)" -bc5283,37,Film - BW,1968-05-10,10:57:00,01:12:00,153,B-022-WR-68,093l05921,093L09,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5283/bc5283_037_thumb.jpg,"c(-126.2987, 54.5015)" -bc5300,196,Film - BW,1968-07-31,09:50:00,,153,B-012-AF-68,093l05913,093L09,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5300/bc5300_196_thumb.jpg,"c(-126.3728, 54.52621)" -bc5300,240,Film - BW,1968-07-31,10:20:00,,153,B-012-AF-68,093l05822,093L09,No,https://openmaps.gov.bc.ca/thumbs/1968/bc5300/bc5300_240_thumb.jpg,"c(-126.4495, 54.51071)" diff --git "a/posts/2024-11-15-bcdata-ortho-historic/fig/Screenshot 2024-11-15 at 2.03.42\342\200\257PM.png" b/posts/2024-11-15-bcdata-ortho-historic/fig/Screenshot1.png similarity index 100% rename from "posts/2024-11-15-bcdata-ortho-historic/fig/Screenshot 2024-11-15 at 2.03.42\342\200\257PM.png" rename to posts/2024-11-15-bcdata-ortho-historic/fig/Screenshot1.png diff --git "a/posts/2024-11-15-bcdata-ortho-historic/fig/Screenshot 2024-11-15 at 2.41.57\342\200\257PM.png" b/posts/2024-11-15-bcdata-ortho-historic/fig/Screenshot2.png similarity index 100% rename from "posts/2024-11-15-bcdata-ortho-historic/fig/Screenshot 2024-11-15 at 2.41.57\342\200\257PM.png" rename to posts/2024-11-15-bcdata-ortho-historic/fig/Screenshot2.png diff --git a/posts/2024-11-15-bcdata-ortho-historic/index.qmd b/posts/2024-11-15-bcdata-ortho-historic/index.qmd index f1bf07a..cc7e1bc 100644 --- a/posts/2024-11-15-bcdata-ortho-historic/index.qmd +++ b/posts/2024-11-15-bcdata-ortho-historic/index.qmd @@ -206,11 +206,14 @@ It looks like this. ```{r fig1} knitr::include_graphics(fs::path( path_post, - "fig/Screenshot 2024-11-15 at 2.03.42 PM", + "fig", + "Screenshot1", ext = "png" ) ) +# knitr::include_graphics("fig/Screenshot 2024-11-15 at 2.03.42 PM.png") + ``` Let's read in what we have, turn into spatial object, trim to overall study area and plot @@ -275,7 +278,8 @@ We can use the `downstream_route_measure` of the stream layer to exclude areas u ```{r fig2} knitr::include_graphics(fs::path( path_post, - "fig/Screenshot 2024-11-15 at 2.41.57 PM", + "fig", + "Screenshot2", ext = "png" ) ) @@ -361,7 +365,7 @@ photos |> ``` -We can view and download this file [here](https://github.com/NewGraphEnvironment/new_graphiti/tree/main/posts/2024-11-15-bcdata-ortho-historic/exports/airphotos_1968-05-09_1968-07-31.csv) +We can view and download exported csv file [here](https://github.com/NewGraphEnvironment/new_graphiti/tree/main/posts/2024-11-15-bcdata-ortho-historic/exports/) ```{r eval = FALSE} leaflet::leaflet() |>