BAAQMD / geotools

Tools to support GIS work in inventoryverse
0 stars 0 forks source link

Handle mix of sf and sp classes in filter_spatial() #1

Open dholstius opened 4 years ago

dholstius commented 4 years ago

Tests in tests/testthat/test-filter_spatial() are not currently passing. To run them: test(filter = "filter_spatial"). Here are two key pieces of the output:

test-filter_spatial.R:31: error: Alameda County (sp)
no applicable method for 'st_transform' applied to an object of class "c('SpatialPolygonsDataFrame', 'SpatialPolygons', 'Spatial', 'SpatialPolygonsNULL', 'SpatialVector')"
Backtrace:
  1. testthat::expect_success(...) tests/testthat/test-filter_spatial.R:31:2
  2. mapview::mapview(test_tracts)
 10. mapview::addFeatures(., ALA_county_WGS84, fill = FALSE, color = "red")
 16. leafem::addFeatures(map = map, data = data, pane = pane, ...)
 17. sf::st_transform(data, sf::st_crs(map@object[[1]]))
test-filter_spatial.R:76: error: Richmond CARE Impact Region
unable to find an inherited method for function 'proj4string' for signature '"sf"'
Backtrace:
 1. testthat::expect_message(...) tests/testthat/test-filter_spatial.R:76:2
 6. geotools::filter_spatial(spobj1, spobj2)
 7. geotools::filter_spatial_sp(x, y, FUN = FUN, ..., verbose = verbose) R/filter_spatial.R:26:4
 8. sp::proj4string(spobj2) R/filter_spatial.R:92:2

It might be necessary to either: