-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from humaniverse/add-ltla-2024
Add LTLA 2024 boundaries
- Loading branch information
Showing
6 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# ---- Load ---- | ||
library(tidyverse) | ||
library(sf) | ||
library(lobstr) | ||
library(devtools) | ||
|
||
# Load package | ||
load_all(".") | ||
|
||
# Set query url | ||
query_url <- | ||
query_urls |> | ||
filter(id == "ltla24") |> | ||
pull(query) | ||
|
||
lad <- | ||
read_sf(query_url) |> | ||
st_transform(crs = 4326) | ||
|
||
# Select and rename vars | ||
lad <- | ||
lad |> | ||
select( | ||
ltla24_name = LAD24NM, | ||
ltla24_code = LAD24CD, | ||
geometry | ||
) | ||
|
||
# Make sure geometries are valid | ||
lad <- st_make_valid(lad) | ||
|
||
# Check geometry types are homogenous | ||
if (lad |> | ||
st_geometry_type() |> | ||
unique() |> | ||
length() > 1) { | ||
stop("Incorrect geometry types") | ||
} | ||
|
||
if (lad |> | ||
st_geometry_type() |> | ||
unique() != "MULTIPOLYGON") { | ||
stop("Incorrect geometry types") | ||
} | ||
|
||
# Check object is below 50Mb GitHub warning limit | ||
if (obj_size(lad) > 50000000) { | ||
stop("File is too large") | ||
} | ||
|
||
# Rename | ||
boundaries_ltla24 <- lad | ||
|
||
# Save output to data/ folder | ||
usethis::use_data(boundaries_ltla24, overwrite = TRUE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.