context("geocode")
test_that("Malvina Place is returned", {
out <- geocode(flat_number = NA_character_,
number_first = 8L,
street_name = "MALVINA",
street_type = "PLACE",
postcode = 3053L)
# About 10 m
expect_equal(round(out$LATITUDE, 4), -37.8006, tol = 0.0001)
expect_equal(round(out$LONGITUDE, 4), 144.9617, tol = 0.0001)
})
test_that("Multi-length", {
input <-
list(number_first = c(186L, 30L, 2L, 2L, 36L),
street_name = c("SUTHERLAND", "THRELFALL", "FREEMAN", "LUGANO", "PARRAMATTA"),
postcode = c(2021L, 2122L, 2067L, 2230L, 2230L),
street_type = c("STREET", "ST", "RD", "AVE", "ST"))
out <-
geocode(number_first = input$number_first,
street_name = input$street_name,
postcode = input$postcode,
street_type = input$street_type,
attempt_decode_street_abbrev = TRUE)
expect_equal(nrow(out), 5)
expect_equal(out$ordering, seq_along(out$ordering))
})
test_that("Inexact street number results in nearby address", {
skip("Not yet fixable")
BerithRd48 <- geocode(number_first = c(45, 47, 49),
street_name = "Berith",
street_type = "Road",
postcode = 2145)
expect_true(BerithRd48$LATITUDE[2] %between% c(BerithRd48$LATITUDE[-2] + c(-1, 1) / 1000))
expect_true(BerithRd48$LONGITUDE[2] %between% c(BerithRd48$LONGITUDE[-2] + c(-1, 1) / 1000))
})
test_that("2022 Feb", {
constable_st <-
geocode(number_first = 16L,
street_name = "CONSTABLE",
street_type = "STREET",
postcode = 2611L)
lat <- round(constable_st$LATITUDE, 4)
lon <- round(constable_st$LONGITUDE, 3)
expect_equal(lat, -35.2715)
expect_equal(lon, 149.049)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.