url <- "ftp://ftp.bom.gov.au/anon/home/geofabric/"Get australia geofabric
To get the australia river geofabric gdb. The links are here, the mapservice links are all annoyingly interactive, though I imagine there’s a way to httr2 them.
See what’s there
files <- RCurl::getURL(url) |>
strsplit("\r*\n") |>
unlist()filenames <- stringr::str_extract(files, '\\s([^ ]+)$') |>
stringr::str_remove_all(' ')
filenames [1] "GW_Cartography_GDB_V3_3.zip"
[2] "Geofabric_Metadata_GDB_V3_3.zip"
[3] "Geofabric_National_V3_3_PRODUCT_README.txt"
[4] "Geofabric_Sample_Toolset_v1_6_1.zip"
[5] "Geofabric_V3x_FTP_README.txt"
[6] "Geofabric_V3x_Feedback_Form.docx"
[7] "HR_Catchments_GDB_V3_3.zip"
[8] "HR_Regions_GDB_V3_3.zip"
[9] "SH_Cartography_GDB_V3_3.zip"
[10] "SH_Catchments_GDB_V3_3.zip"
[11] "SH_Network_GDB_V3_3.zip"
[12] "version2"
we don’t want ‘version2’, but otherwise, let’s download all of that.
It’s a lot of data, so it’ll take a while. Turn the eval off unless we actually want to run this.
if (!dir.exists('data/geofabric')) {
dir.create('data/geofabric')
}
filestodl <- filenames[filenames != 'version2']
system.time(
purrr::map(filestodl,
\(x) curl::curl_download(paste0(url, x),
destfile = paste0('data/geofabric/', x)))
)