Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a fasterize index #3

Open
mdsumner opened this issue Apr 10, 2018 · 0 comments
Open

a fasterize index #3

mdsumner opened this issue Apr 10, 2018 · 0 comments

Comments

@mdsumner
Copy link
Member

Here's straightforward minimal read and rasterize to pair a raster version of the vegmap to the attributes.

vm <- ".../data_local/tas.gov.au/TASVEG/GDB/TASVEG3.gdb"
library(vapour)
vegdata <- tibble::as_tibble(vapour::vapour_read_attributes(vm))
#66.8Mb
vegeom <- vapour::vapour_read_geometry(vm)
vegeom <- sf::st_as_sfc(vegeom)
library(sf)
x <- st_sf(geometry = vegeom, rownum = seq_along(vegeom))
x$rownum <- seq_len(nrow(x))
library(raster)
r <- raster(spex::buffer_extent(x, 10), res = 10)
library(fasterize)
vegraster <- fasterize::fasterize(x, r, field = "rownum")
saveRDS(vegraster, "vegraster.rds", compress = FALSE)

The tricky part is the size (!) of vegraster, which fasterize for now has to be doubles, so it's 15Gb or so. But will compress extremely well, and with the next release of raster should work for extraction of points from a tiled GeoTIFF.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant