Skip to content

Instantly share code, notes, and snippets.

View szechno's full-sized avatar

mackaszechno szechno

View GitHub Profile
library(sf)
library(dplyr)
library(readr)
library(tidyr)
library(tidygraph)
library(sfnetworks)
library(stplanr)
library(stringr)
library(purrr)
library(mapview)
# prelim functions
# download oemextract and clean up ----
get_oemextract <- function(wsx = "D:/data_store/Boundaries/county/county.shp"){
message("Warning this will take 5-10 mins")
wsx <- sf::read_sf(wsx) |> dplyr::select(geometry)
wsx_roads <- osmextract::oe_get(
wsx |> st_transform(crs = 4326),
query = "SELECT * FROM 'lines' WHERE highway IN ('footway', 'unclassified',
'service', 'track', 'bridleway', 'path', 'residential', 'tertiary',
# data available from DfT website
library(mapgl)
library(sf)
library(dplyr)
library(osmdata)
library(magrittr)
geodata <- "./data/west sussex_tss_review_20250714a_esuid.gpkg"
st_layers(geodata)
dft <- read_sf(geodata, layer = "DfT Counts")
library(sf)
library(dplyr)
library(mapgl)
library(units)
d <- read_sf("./data/STRLIGHT/STRLIGHT.shp")
maplibre(style = carto_style("dark-matter-no-labels")) |>
fit_bounds(d) |>
add_circle_layer(id = "Streetlighting2",
# https://wikishire.co.uk/lookup/
# https://wikishire.co.uk/wiki/Sussex
# https://en.wikipedia.org/wiki/Rape_(county_subdivision)
# https://britishcountyflags.com/2020/09/14/_the-rapes-of-sussex/
library(sf)
library(dplyr)
library(mapgl)
library(units)
library(mapgl)
library(sf)
library(stringr)
library(dplyr)
library(readr)
library(lubridate)
library(tidyr)
# read in data and tidy up
locations <- read_csv("./data/afghanistan.csv") |>
library(rnaturalearth)
library(rnaturalearthdata)
library(mapgl)
library(mapview)
library(sf)
library(dplyr)
antartic10 <- ne_download(scale = 50, type = 'antarctic_ice_shelves_polys',
category = 'physical')
antartic10l <- ne_download(scale = 50, type = 'antarctic_ice_shelves_lines',
library(mapgl)
library(sf)
library(stringr)
library(dplyr)
library(magrittr)
library(osmdata)
map_start <- c(-0.404549247616387, 50.9365654134795)
initial_zoom <- 10
library(rnaturalearth)
library(rnaturalearthdata)
library(mapgl)
library(sf)
library(dplyr)
library(rmapshaper)
# https://www.naturalearthdata.com/features/
rivers50 <- ne_download(scale = 50, type = 'rivers_lake_centerlines',
library(sf)
library(shiny)
library(dplyr)
library(readr)
library(units)
library(mapgl)
library(stringr)
# d |> filter((end >= set_units(2020, "year")) & (end <= set_units(2029, "year"))| is.na(end)) |> View()
#