vapour icon indicating copy to clipboard operation
vapour copied to clipboard

row/col value extract

Open mdsumner opened this issue 2 years ago • 3 comments

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,""))

mdsumner avatar Feb 27 '23 03:02 mdsumner

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

mdsumner avatar Feb 27 '23 05:02 mdsumner

good enough

mdsumner avatar Feb 27 '23 05:02 mdsumner

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

mdsumner avatar Feb 27 '23 07:02 mdsumner