Open jebyrnes opened 6 years ago
You might try spex::polygonize
, it uses a "dense-mesh" model to index the corner coordinates and build the sp polygons. It's pretty fast (but at some point it just becomes a bad idea to convert pixels to expanded polygons, since the entire mesh can stay implicit).
Aand, actually I've had another look and I can't see a fast way to convert from sf to sp, which kind of makes the speedup moot, unless you move to using sf, so nvm.
This is actually useful - can one go from the meshed polygons to something smoother?
And, honestly, the job I have requires polygonizing thousands of small rasters, so the speedup is a lifesaver. I can do the conversion to a big sp object later.
See isoband package now on CRAN
Your rasterize function is amazing and has sped up my workflow immensely. Can the same principle be applied to going the other way, which often takes even longer?