Closed adrfantini closed 5 years ago
I'm catching up on issues in this repo after a long delay, sorry! Yes, this is in the works, I've done some initial testing and it will be considerably faster than spex. But I don't think it'll happen until early summer.
Awesome :)
See my stars
issue where I delineate performance numbers. Edzer was thinking of building gdal_polygonize into gdal_utils
.
Dear Noam, is your faster alternative to RasterToPolygon available ? Thank you very much.
If you can use stars
instead of raster
, st_as_sf(..., point = FALSE, merge = TRUE, connect8 = TRUE)
is now very fast, since it uses GDAL directly.
Claus Wilke's isoband package also has a fast implementation now: https://github.com/wilkelab/isoband . I don't think I am likely to implement this given the options available.
I know a faster alternative to
rasterToPolygons
was in the plans, is this still true? Usingst_as_sf(stars(file))
instead ofas(rasterToPolygons(raster(file)), "sf")
is an option, but still it's not as fast as one would like (about 2x faster in my limited tests), andstars
is still in it's infancy so bugs and incompatibilities are present.EDIT: maybe something similar, through GDAL, has already been attempted:
https://gist.github.com/johnbaums/26e8091f082f2b3dd279#file-polygonizer-r
https://johnbaumgartner.wordpress.com/2012/07/26/getting-rasters-into-shape-from-r/
EDIT2:
spex::polygonize
might be the answer. It's crazy fast compared to rasterToPolygons, about 10x as fast from my tests.