-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
102 lines (81 loc) · 3.02 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
---
output: github_document
editor_options:
markdown:
wrap: 72
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
library(sf, quietly = TRUE)
set.seed(2022)
```
# nswgeo
<!-- badges: start -->
[![nswgeo status badge](https://cidm-ph.r-universe.dev/badges/nswgeo)](https://cidm-ph.r-universe.dev)
[![R-CMD-check](https://github.com/cidm-ph/nswgeo/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/cidm-ph/nswgeo/actions/workflows/R-CMD-check.yaml)
[![CRAN status](https://www.r-pkg.org/badges/version/nswgeo)](https://CRAN.R-project.org/package=nswgeo)
<!-- badges: end -->
A collection of geospatial datasets and map plotting helpers for working
with New South Wales maps. The maps are registered with `{cartographer}`.
This package is not an official publication, merely a collection of handy data
from public sources.
## Installation
You can install nswgeo like so:
``` r
# CRAN release
install.packages('nswgeo')
# development version
install.packages('nswgeo', repos = c('https://cidm-ph.r-universe.dev', 'https://cloud.r-project.org'))
```
## Examples
The data can be used directly with ggplot:
```{r ggplot, fig.width=5, fig.height=4.7, fig.dpi=300}
library(nswgeo)
library(ggplot2)
ggplot(nswgeo::nsw) +
geom_sf(fill = "white", data = nswgeo::australia) +
geom_sf(fill = "#9BCBEB", colour = NA) +
geom_sf(fill = NA, colour = "white", data = nswgeo::lhd) +
geom_sf(fill = NA, colour = "#002664", linewidth = .8) +
annotate(
"text", x = 144, y = -27, label = "New South Wales",
angle = -5, size = 5, fontface = "italic", colour = "#002664"
) +
coord_sf(crs = crs_gda2020_albers(), default_crs = crs_gda2020()) +
theme_minimal() +
theme(
panel.background = element_rect(fill = "grey97", colour = NA),
axis.title = element_blank(),
)
```
Alternatively, the data can be accessed through `{cartographer}`:
```{r cartographer}
library(cartographer)
head(covid_cases_nsw)
covid_cases_nsw |>
dplyr::count(lga) |>
add_geometry(lga, feature_type = "nswgeo.lga") |>
ggplot() +
geom_sf(aes(fill = n)) +
geom_sf(fill = NA, data = map_sf("nswgeo.lga")) +
scale_fill_viridis_b("Cases") +
theme_void()
```
## A note on resolution
Some of the source datasets are very high resolution and would make this package
too large if they were bundled. Accordingly, most data has been processed to
reduce the resolution. You can see exactly what was done by looking at the
scripts in `data-raw/`, which also help to download source data.
If you need higher resolution shapes, such as when zooming into specific postal
areas, you're better off using the original datasets directly.
## Other Australian data
* [`strayr`](https://runapp-aus.github.io/strayr/) helps with working with
data from the Australian Bureau of Statistics (ABS).
* [`absmapsdata`](https://github.com/wfmackey/absmapsdata) contains some
processed ABS geospatial data.