Title: | Geospatial Data and Maps for New South Wales, Australia |
---|---|
Description: | Geospatial data for creating maps of New South Wales (NSW), Australia, and some helpers to work with common problems like normalising postcodes. Registers its data with 'cartographer'. |
Authors: | Carl Suster [aut, cre] |
Maintainer: | Carl Suster <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.4.0.9000 |
Built: | 2024-08-13 18:59:07 UTC |
Source: | https://github.com/cidm-ph/nswgeo |
This package contains geospatial data for the NSW border and several types of features. It also contains some map plotting helpers to help you get from a data frame to a plot for common scenarios.
Maintainer: Carl Suster [email protected] (ORCID)
Other contributors:
Western Sydney Local Health District, NSW Health [copyright holder]
Useful links:
Report bugs at https://github.com/cidm-ph/nswgeo/issues
Excludes external territories.
australia states
australia states
An object of class sfc_MULTIPOLYGON
(inherits from sfc
) of length 1.
An object of class sf
(inherits from tbl_df
, tbl
, data.frame
) with 8 rows and 9 columns.
The geometries have been simplified with a tolerance of 5 km to reduce the level of detail.
australia
: External boundaries of Australia as a multipolygon.
states
: State and internal territory boundaries of Australia.
Australian Bureau of Statistics. "Australian Statistical Geography Standard (ASGS) Edition 3." ABS, Jul2021-Jun2026, https://www.abs.gov.au/statistics/standards/australian-statistical-geography-standard-asgs-edition-3/jul2021-jun2026, accessed 10 November 2022.
The original dataset is published under the Creative Commons Attribution 4.0 International licence, © Commonwealth of Australia 2021.
library(ggplot2) ggplot(states) + geom_sf(aes(fill = STE_NAME21))
library(ggplot2) ggplot(states) + geom_sf(aes(fill = STE_NAME21))
This subset covers a random selection of entries from 3 LGAs, and ignores the case count field.
covid_cases_nsw
covid_cases_nsw
A data frame with 100 rows and the following columns:
The postal code
The name of the Local Health District
The name of the Local Government Area
A synthetic disease type/lineage/etc., either A or B
Year of the case notification
NSW Ministry of Health. "NSW COVID-19 cases by location." https://data.nsw.gov.au/data/dataset/covid-19-cases-by-location, accessed 11 October 2022.
The original dataset is published under the Creative Commons Attribution 4.0 licence, © State of New South Wales 2020-2022.
head(covid_cases_nsw)
head(covid_cases_nsw)
GDA2020 is the official CRS used by the Commonwealth and NSW. Geospatial data in this package uses GDA2020.
crs_gda2020() crs_gda2020_cartesian() crs_gda2020_albers()
crs_gda2020() crs_gda2020_cartesian() crs_gda2020_albers()
crs_gda2020
is EPSG 7844 with axes specified in degrees.
crs_gda2020_cartesian
is EPSG 7842 with Cartesian axes in metres.
crs_gda2020_albers
is EPSG 9473, the Albers equal area projection used for
area computation.
A simple features CRS
These include the Unincorporated Far West Region.
lga_nsw
excludes Jervis Bay Territory and the ACT.
poa_nsw
includes both territories and some postal areas extend past the
state boundary.
lga_nsw poa_nsw
lga_nsw poa_nsw
An object of class sf
(inherits from tbl_df
, tbl
, data.frame
) with 131 rows and 9 columns.
An object of class sf
(inherits from tbl_df
, tbl
, data.frame
) with 644 rows and 7 columns.
The geometries have been simplified with a tolerance of 750 m to reduce the level of detail.
lga_nsw
: Local Government Area boundaries of New South Wales.
poa_nsw
: Postal area boundaries of New South Wales.
Australian Bureau of Statistics. "Australian Statistical Geography Standard (ASGS) Edition 3." ABS, Jul2021-Jun2026 (24 July 2024 update), https://www.abs.gov.au/statistics/standards/australian-statistical-geography-standard-asgs-edition-3/jul2021-jun2026, accessed 29 July 2024.
The original dataset is published under the Creative Commons Attribution 4.0 International licence, © Commonwealth of Australia 2021.
library(ggplot2) ggplot(lga_nsw) + geom_sf(aes(fill = LGA_NAME_2024), show.legend = FALSE) library(sf) sf_use_s2(FALSE) # cut out part of the postcode dataset (it's quite large) bbox <- st_bbox(c(xmin = 142, xmax = 147, ymin = -33, ymax = -30)) |> st_as_sfc(crs = crs_gda2020()) st_crop(poa_nsw, bbox) |> ggplot() + geom_sf() + geom_sf_text(aes(label = POA_CODE_2021), size = 4)
library(ggplot2) ggplot(lga_nsw) + geom_sf(aes(fill = LGA_NAME_2024), show.legend = FALSE) library(sf) sf_use_s2(FALSE) # cut out part of the postcode dataset (it's quite large) bbox <- st_bbox(c(xmin = 142, xmax = 147, ymin = -33, ymax = -30)) |> st_as_sfc(crs = crs_gda2020()) st_crop(poa_nsw, bbox) |> ggplot() + geom_sf() + geom_sf_text(aes(label = POA_CODE_2021), size = 4)
The geometries have been simplified with a tolerance of 750 m to reduce the level of detail.
lhd
lhd
An object of class sf
(inherits from tbl_df
, tbl
, data.frame
) with 15 rows and 11 columns.
Spatial Services, Department of Customer Service NSW. "MyHospitals_Public", https://portal.spatial.nsw.gov.au/portal/home/item.html?id=5a1e5dd9b38245d3b976c21b56fd6185, accessed 4 May 2023. Republished from NSW Ministry of Health, "Map of local health districts", https://www.health.nsw.gov.au/lhd/Pages/lhd-maps.aspx.
The original dataset is published under the Creative Commons Attribution 4.0 International licence, © State of New South Wales NSW Ministry of Health 2023. For current information go to https://www.health.nsw.gov.au.
library(ggplot2) ggplot(lhd) + geom_sf(aes(fill = lhd_name), show.legend = FALSE)
library(ggplot2) ggplot(lhd) + geom_sf(aes(fill = lhd_name), show.legend = FALSE)
Some special postcodes are used in addresses, such as codes for post office boxes. This helper converts those to the postcode for the closest normal suburb if there is a reasonable clear match. If there is no good match, the postcodes are left unchanged.
normalise_postcodes(codes)
normalise_postcodes(codes)
codes |
Character vector of postcodes (or coercible to one). |
Note that this goes a little further than the aliases that are registered with cartographer (which only account for postcodes with no geospatial data in the ABS dataset).
Character vector of the same size as the input, but with the normalised postcodes.
normalise_postcodes(c(1685, 2000, 1010, 2129, 2145))
normalise_postcodes(c(1685, 2000, 1010, 2129, 2145))
Expand abbreviations like "NSW"
to "New South Wales"
, and
normalise to title capitalisation. Entries that don't match any state name or
abbreviation are left untouched.
normalise_state_names(names)
normalise_state_names(names)
names |
Character vector of state names. |
Vector of the same size as the input, but with the normalised state names.
normalise_state_names(c("nsw", "VIC", "overseas", "Queensland"))
normalise_state_names(c("nsw", "VIC", "overseas", "Queensland"))
Lord Howe Island is administratively part of NSW, but as it is a small island some 600 km off the coast, it is frequently omitted from maps of NSW.
nsw act lhi jbt sydney
nsw act lhi jbt sydney
An object of class sfc_MULTIPOLYGON
(inherits from sfc
) of length 1.
An object of class sfc_MULTIPOLYGON
(inherits from sfc
) of length 1.
An object of class sfc_MULTIPOLYGON
(inherits from sfc
) of length 1.
An object of class sfc_MULTIPOLYGON
(inherits from sfc
) of length 1.
An object of class sfc_POLYGON
(inherits from sfc
) of length 1.
The Australian Capital Territory is an enclave within NSW, and Jervis Bay Territory is a small Australian territory on the coast, surrounded by NSW. Neither are NSW territory, but they affect the shape of NSW's outline and are sometimes useful to include in maps alongside NSW due to their locations.
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. sydney
is simplified with a 500 m tolerance.
nsw
: External state boundary excluding LHI but including ACT and JBT.
act
: Australian Capital Territory boundary.
lhi
: Lord Howe Island boundary.
jbt
: Jervis Bay Territory boundary.
sydney
: Greater Sydney boundary.
Australian Bureau of Statistics. "Australian Statistical Geography Standard (ASGS) Edition 3." ABS, Jul2021-Jun2026 (24 July 2024 update), https://www.abs.gov.au/statistics/standards/australian-statistical-geography-standard-asgs-edition-3/jul2021-jun2026, accessed 29 July 2024.
The original dataset is published under the Creative Commons Attribution 4.0 International licence, © Commonwealth of Australia 2021.
The default outline nswgeo::nsw
includes Jervis Bay Territory, excludes
Lord Howe Island, and does not have a cut out for the ACT. This utility
allows each of these to be adjusted.
outline(lord_howe_island = FALSE, act_cutout = FALSE, jervis_bay = TRUE)
outline(lord_howe_island = FALSE, act_cutout = FALSE, jervis_bay = TRUE)
lord_howe_island |
Include Lord Howe Island. |
act_cutout |
Cut out the area of the Australian Capital Territory. |
jervis_bay |
Cover the area of the Jervis Bay Territory. |
A simple features data frame with the requested geometries.
library(ggplot2) outline(lord_howe_island = TRUE) |> ggplot() + geom_sf()
library(ggplot2) outline(lord_howe_island = TRUE) |> ggplot() + geom_sf()
The geometries have been simplified with a tolerance of 500 m to reduce the level of detail.
phn
phn
An object of class sf
(inherits from tbl_df
, tbl
, data.frame
) with 10 rows and 9 columns.
National Recovery and Resilience Agency, "PHN Boundaries used by the NBRA", https://data.gov.au/data/dataset/phn-boundaries-used-by-the-nbra, accessed 25 May 2023.
The original dataset is published under the Creative Commons Attribution 2.5 Australia licence, © Commonwealth of Australia 2021.
Contains the other administrative geometries which intersect with the local health district boundaries, along with the size of the intersection.
poa_lhd_concordance
poa_lhd_concordance
An object of class data.frame
with 825 rows and 5 columns.
For geographic regions used by the Australian Bureau of Statistics (ABS), the ABS publishes correspondence files. These files compare how two different types of regions align with each other. The Australian Government Department of Health and Aged Care published analogous concordance files for primary health networks (PHNs). These are useful for mapping between different types of administrative districts. There does not appear to be a publicly available set of concordance files for New South Wales local health district geographies.
The concordance was computed here by intersecting the ABS geometries with the
local health district geometries. The fraction of the ABS geometry's area
included in the intersection is reported in the column FRAC_INCLUDED
.
Any intersection with FRAC_INCLUDED
at least 0.01% was retained.
Area computations were performed in crs_gda2020_albers()
(EPSG 9473 equal
area Albers) coordinates at the original reolution of the source data.
Note that postal areas are not precisely the same as postcodes used by Australia Post, however they are very similar.
Computed using the same source datasets as lhd
and poa_nsw
.
library(dplyr) # postcodes that overlap with Murrumbidgee LHD poa_lhd_concordance |> filter(lhd_name == "Murrumbidgee", FRAC_INCLUDED > 0.005) |> arrange(desc(FRAC_INCLUDED)) |> pull(POA_NAME_2021)
library(dplyr) # postcodes that overlap with Murrumbidgee LHD poa_lhd_concordance |> filter(lhd_name == "Murrumbidgee", FRAC_INCLUDED > 0.005) |> arrange(desc(FRAC_INCLUDED)) |> pull(POA_NAME_2021)
Derived from several government sources with some community curation. This version additionally attempts to canonicalise non-physical postcodes to assist with mapping.
postcodes
postcodes
A data frame with 7 columns:
A postal code
A suburb or locality
NSW
Statistical Area 2 name to assist with disambiguating localities with identical names
Flag indicating this is a post office box, mail distribution centre or other special postal code
Flag indicating that this code appears to have been superseded
The closest canonical postal code, e.g. mapping post office boxes to the main suburb's postal code
Matthew Proctor. "Australian Postcodes", https://www.matthewproctor.com/australian_postcodes, accessed 6 February 2023.
The original dataset is released to the public domain.
set.seed(12345) postcodes[sort(sample.int(nrow(postcodes), 5)),]
set.seed(12345) postcodes[sort(sample.int(nrow(postcodes), 5)),]
A dataset containing the names of suburbs in NSW and their postcodes. These fields are extracted as-is from the source dataset published by DCS Spatial Services, NSW Government.
suburbs
suburbs
A data frame with 2 columns:
The name of the suburb, in upper case
The main postcode of the suburb, as a character
Spatial Services, Department of Customer Service NSW. "NSW Administrative Boundaries Theme - Suburb." https://portal.spatial.nsw.gov.au/portal/home/item.html?id=38bdaa10b7cc41a3a19be6eca91f5368, accessed 21 September 2022.
The original dataset is published under the Creative Commons Attribution 4.0 International licence, © State of New South Wales (Spatial Services, a business unit of the Department of Customer Service NSW).