vapour
vapour copied to clipboard
row/col value extract
trying out in
vapour_read_raster_value_cpp
via
gdalraster::gdal_read_band_value
- [x] get the band just once and loop over window with that
- [ ] Float64 only so far
pts <- geosphere::randomCoordinates(4e5)
pts <- pts[order(pts[,2], pts[,1]), ]
cell <- vaster::cell_from_xy(info$dimension, info$extent, pts)
row <- vaster::row_from_cell(info$dimension, cell)
col <- vaster::col_from_cell(info$dimension, cell)
## about 4 seconds
system.time(v <- vapour:::vapour_read_raster_value_cpp(dsn,as.integer(col - 1),as.integer(row - 1), 1,""))
actually it takes about 30s on a well set up VRT DSN of GHRSST
subsequent calls take less than 4s, even with new points - so presumably GDAL has a cache of the raster data
good enough
I expect that a tiled visit would improve this, so that might be a thing for vaster to pre-index, you need
what points belong in what tile
index points to the buffer
send in a list of the block offsets to read and the buffer index