shawnlaffan / biodiverse

A tool for the spatial analysis of diversity
http://shawnlaffan.github.io/biodiverse/
GNU General Public License v3.0
75 stars 19 forks source link

raster imports: Use a def query to constrain imports #805

Open shawnlaffan opened 2 years ago

shawnlaffan commented 2 years ago

Extracted from to do list for #761 but has more general application.

Use a def query to speed up analyses. Target basedata might be a very small subset of the raster being imported, for example global data from Worldclim being applied to a basedata of Indonesian plants.

Def query for property imports can be the intersection of the extents.

shawnlaffan commented 2 years ago

It should be possible to do this using a Virtual Raster Table to map into the target raster: https://gdal.org/drivers/raster/vrt.html#simplesource

Probably only need to do so when bounds overlap, and adjust the VRT to the intersection so we avoid processing a heap of nodata.