tests/testthat/test-galah_geolocate.R

test_that("galah_geolocate defaults to galah_polygon", {
  wkt <- "POLYGON((142.36228 -29.00703,142.74131 -29.00703,142.74131 -29.39064,142.36228 -29.39064,142.36228 -29.00703))"
  expect_match(galah_geolocate(wkt), "MULTIPOLYGON")
})

test_that("galah_geolocate works when type is set to polygon", {
  wkt <- "POLYGON((142.36228 -29.00703,142.74131 -29.00703,142.74131 -29.39064,142.36228 -29.39064,142.36228 -29.00703))"
  expect_match(galah_geolocate(wkt, type = "polygon"), "MULTIPOLYGON")
})

test_that("galah_geolocate switches to use galah_bbox when type is set to bbox", {
  wkt <- "POLYGON((142.36228 -29.00703,142.74131 -29.00703,142.74131 -29.39064,142.36228 -29.39064,142.36228 -29.00703))"
  obj_sf <- wkt |> sf::st_as_sfc()
  expect_error(galah_geolocate(wkt, type = "bbox"))
  expect_match(galah_geolocate(obj_sf, type = "bbox"), "MULTIPOLYGON")
})

Try the galah package in your browser

Any scripts or data that you put into this service are public.

galah documentation built on Nov. 20, 2023, 9:07 a.m.