tests/testthat/test-to_wkt.R

context("to_wkt")

suppressPackageStartupMessages(library("rgeos"))
wkt <- "POLYGON((-180 -20, -140 55, 10 0, -140 -60, -180 -20))"
poly <- readWKT(wkt)
polys <- chop(x = poly)

test_that("to_wkt works for SpatialPolygons input", {
  aa <- to_wkt(polys)

  expect_is(aa, "axewkt")
  expect_is(aa[[1]], "character")
  expect_match(aa[[1]], "POLYGON")
  expect_equal(length(aa), 139)
})

test_that("to_wkt works for axewkt (self) input", {
  aa <- to_wkt(polys)
  bb <- to_wkt(aa)

  expect_is(aa, "axewkt")
  expect_is(bb, "axewkt")
  expect_identical(aa, bb)
})

Try the geoaxe package in your browser

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

geoaxe documentation built on May 2, 2019, 6:33 a.m.