Skip to content

Commit

Permalink
Add Greater Sydney boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
arcresu committed Jan 11, 2024
1 parent 9dfadc4 commit ff3a41b
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 2 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Fixed the `poa_nsw` dataset to avoid strange geometries near the state border.
* Added geometries for Lord Howe Island, Australian Capital Territory, and
Jervis Bay Territory, and a utility function `outline()` for using them.
* Add Greater Sydney boundary as `sydney` dataset.
* Slightly increase the resolution to 750 m instead of 1 km.
* Update to the 2023 ASGS release, including the 2023 LGA shapefile.

Expand Down
4 changes: 3 additions & 1 deletion R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#'
#' The geometry for `nsw` has been simplified with a tolerance of 750 m to
#' reduce the level of detail, whereas the territories maintain their full
#' resolution.
#' resolution. `sydney` is simplified with a 500 m tolerance.
#'
#' @seealso [outline()]
#' @source
Expand All @@ -65,6 +65,8 @@
"lhi"
#' @describeIn nsw Jervis Bay Territory boundary.
"jbt"
#' @describeIn nsw Greater Sydney boundary.
"sydney"

#' Geospatial data of the New South Wales administrative boundaries.
#'
Expand Down
1 change: 1 addition & 0 deletions data-raw/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ MyHospitals_Public.zip
MyHospitals_Public/
confirmed_cases_table1_location_agg.csv
STE_2021_AUST_SHP_GDA2020*
GCCSA_2021_AUST_SHP_GDA2020*
phn.geojson
35 changes: 35 additions & 0 deletions data-raw/sydney.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
gccsa_shapefile <- "data-raw/GCCSA_2021_AUST_SHP_GDA2020/GCCSA_2021_AUST_GDA2020.shp"

if (!file.exists(abs_geopackage)) {
# https://www.abs.gov.au/statistics/standards/australian-statistical-geography-standard-asgs-edition-3
message("Downloading the source dataset from the ABS website...")
asgs_3e_url <- "https://www.abs.gov.au/statistics/standards/australian-statistical-geography-standard-asgs-edition-3/jul2021-jun2026/access-and-downloads/digital-boundary-files/GCCSA_2021_AUST_SHP_GDA2020.zip"
download.file(asgs_3e_url, destfile = "data-raw/GCCSA_2021_AUST_SHP_GDA2020.zip")

unzip("data-raw/GCCSA_2021_AUST_SHP_GDA2020.zip", exdir = "data-raw/GCCSA_2021_AUST_SHP_GDA2020")
stopifnot(file.exists(gccsa_shapefile))
}

library(sf)
library(dplyr)
library(nngeo)

# reduce the resolution of the borders to 1km
tolerance_m <- 500L

crs_nsw <- sf::st_crs(7844) # GDA2020
crs_working <- sf::st_crs("+proj=eqc +lat_ts=34 units=m")

# st_layers(gccsa_shapefile)
gccsa <- read_sf(gccsa_shapefile, layer = "GCCSA_2021_AUST_GDA2020")

sydney_hires <- filter(gccsa, GCC_NAME21 == "Greater Sydney")
sydney <- sydney_hires |>
st_transform(crs_working) |>
st_simplify(dTolerance = tolerance_m) |>
st_transform(crs_nsw) |>
st_geometry()
object.size(sydney_hires)
object.size(sydney)

usethis::use_data(sydney, overwrite = TRUE)
Binary file added data/sydney.rda
Binary file not shown.
9 changes: 8 additions & 1 deletion man/nsw.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ff3a41b

Please sign in to comment.