Skip to content

Commit

Permalink
Update to 202105
Browse files Browse the repository at this point in the history
  • Loading branch information
HughParsonage committed Jul 19, 2021
1 parent badc6a9 commit cc832fa
Show file tree
Hide file tree
Showing 21 changed files with 28 additions and 21 deletions.
7 changes: 3 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
Package: PSMA
Title: Geocoding and Reverse-Geocoding of Australian Locations
Version: 0.5.0
Date: 2019-01-26
Version: 0.6.0
Date: 2021-07-19
Authors@R: c(person("Hugh", "Parsonage", email = "[email protected]", role = c("aut", "cre")),
person("Richard", "Beare", role = c("aut"), email = "[email protected]"))
Description: Geocoding and reverse-geocoding of Australian addresses using the PSMA data <https://data.gov.au/dataset/geocoded-national-address-file-g-naf>. Incorporates 'G-NAF' by PSMA Australia Limited.
Depends: R (>= 3.4.0)
License: GPL-3
Remotes: hughparsonage/hutilscpp
Imports:
data.table,
magrittr,
Expand All @@ -17,7 +16,7 @@ Imports:
fastmatch
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.0.2
RoxygenNote: 7.1.1
Suggests:
scales,
bench,
Expand Down
Binary file modified R/sysdata.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ isAttached <- function(pkg) {
}
}

utils2km <- function(string) {
dist2km <- function(string) {
stopifnot(is.character(string),
length(string) == 1L)
# put km before m!
Expand Down
18 changes: 11 additions & 7 deletions data-raw/put-data.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ library(data.table)
library(magrittr)
library(hutils)
library(hutilscpp)
library(default)
load("R/sysdata.rda")

LATEST <- "~/Data/PSMA-Geocoded-Address-2018/"
default(fread) <- list(showProgress = FALSE)

LATEST <- normalizePath("~/Data/PSMA-Geocoded-Address-202105/",
winslash = "/")

ADDRESS_DETAIL_PID__by__LATLON <-
dir(pattern = "_ADDRESS_DEFAULT_GEOCODE_psv",
Expand Down Expand Up @@ -148,7 +153,7 @@ write_dat_fst2 <- function(x) {

address2 <-
ADDRESS_DETAIL_ID__by__LATLON %>%
.[, .(ADDRESS_DETAIL_INTRNL_ID,
.[, .(ADDRESS_DETAIL_INTRNL_ID, LATITUDE, LONGITUDE,
lat_int = as.integer(LATITUDE),
lat_rem = as.integer(10^7 * (LATITUDE - as.integer(LATITUDE))),
lon_int = as.integer(LONGITUDE),
Expand All @@ -160,8 +165,8 @@ addressB13 <-
ADDRESS_DETAIL_ID__by__LATLON %>%
unique(by = c("LATITUDE", "LONGITUDE"))

lon_range <- addressB13[, range_rcpp(LONGITUDE)[1:2]]
lat_range <- addressB13[, range_rcpp(LATITUDE)[1:2]]
lon_range <- addressB13[, minmax(LONGITUDE)]
lat_range <- addressB13[, minmax(LATITUDE)]

hutilscpp:::cut_DT(addressB13,
depth = 13L,
Expand Down Expand Up @@ -221,14 +226,13 @@ for (addressBs in paste0("addressB", 6:12)) {
write_dat_fst2(addressBs)
}



address2[, c("LATITUDE", "LONGITUDE") := NULL]
write_dat_fst(address2)
write_dat_fst(addressB13_west)
write_dat_fst(addressB13_east)
# write_dat_fst(ADDRESS_DETAIL_ID__by__LATLON)
write_dat_fst(STREET_ID_vs_ADDRESS_ID)
write_dat_fst(STREET_LOCALITY_ID__STREET_NAME_STREET_TYPE_CODE)

devtools::use_data(street_type_decoder, overwrite = TRUE)
usethis::use_data(street_type_decoder, overwrite = TRUE)

Loading

0 comments on commit cc832fa

Please sign in to comment.