Closed frankgalloro closed 5 years ago
Hi @frankgalloro, could you provide a reproducible example (https://www.tidyverse.org/help/)?
Here's the reprex of the example.
library(geogrid)
library(sf)
#> Linking to GEOS 3.6.1, GDAL 2.2.3, proj.4 4.9.3
library(tmap)
input_file <- system.file("extdata", "london_LA.json", package = "geogrid")
original_shapes <- st_read(input_file) %>% st_set_crs(27700)
#> Reading layer `london_LA' from data source `C:\Program Files\R\R-3.5.1\library\geogrid\extdata\london_LA.json' using driver `GeoJSON'
#> Simple feature collection with 33 features and 7 fields
#> geometry type: MULTIPOLYGON
#> dimension: XY
#> bbox: xmin: 503568.2 ymin: 155850.8 xmax: 561957.5 ymax: 200933.9
#> epsg (SRID): 4326
#> proj4string: +proj=longlat +datum=WGS84 +no_defs
#> Warning: st_crs<- : replacing crs does not reproject data; use st_transform
#> for that
original_shapes$SNAME <- substr(original_shapes$NAME, 1, 4)
par(mfrow = c(2, 3), mar = c(0, 0, 2, 0))
for (i in 1:6) {
new_cells <- calculate_grid(shape = original_shapes, grid_type = "hexagonal", seed = i)
plot(new_cells, main = paste("Seed", i, sep = " "))
}
#> Error in get_shape_details_internal(shape): trying to get slot "bbox" from an object (class "sf") that is not an S4 object
Created on 2018-12-07 by the reprex package (v0.2.0).
What's your sessionInfo()
? Which version of geogrid do you use?
The version of geogrid, that I'm using is 0.1.0.1 (The version pulled from CRAN)
Here's the sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_Canada.1252 LC_CTYPE=English_Canada.1252 LC_MONETARY=English_Canada.1252 LC_NUMERIC=C
[5] LC_TIME=English_Canada.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.5.1 tools_3.5.1 yaml_2.2.0 knitr_1.20
@frankgalloro please install the development version (devtools::install_github("jbaileyh/geogrid")
and let us know if it works now.
The development version is working!
Can't thank you guys enough!
I'm getting the following error when trying to follow along with the example documented here.
I'm currently working with a fresh install of R studio and only have the libraries either referenced in the example or the dependents of those libraries installed.