odc.geo.overlap.compute_reproject_roi
- odc.geo.overlap.compute_reproject_roi(src, dst, ttol=0.05, stol=0.001, padding=None, align=None)[source]
Compute reprojection information.
Given two GeoBoxes find the region within the source GeoBox that overlaps with the destination GeoBox, and also compute the scale factor (>1 means shrink). Scale is chosen such that if you apply it to the source image before reprojecting, then reproject will have roughly no scale component.
So we are breaking up reprojection into two stages:
Scale in the native pixel CRS
Reprojection (possibly non-linear with CRS change)
- src[roi] -> scale -> reproject -> dst (using native pixels) - src(scale)[roi(scale)] -> reproject -> dst (using overview image)
Here
roi
is “minimal”, padding is configurable though, so you only read what you need. Also scale can be used to pick the right kind of overview level to read.Applying reprojection in two steps allows us to use pre-computed overviews, particularly useful when shrink factor is large. But even for data sources without overviews there are advantages for shrinking source image before applying reprojection: mainly quality of the output (reduces aliasing for large shrink factors), improved efficiency of the computation is likely as well.
Also compute and return ROI of the dst geobox that is affected by src.
If padding is
None
“appropriate” padding will be used depending on the transform betweensrc<>dst
:No padding beyond sub-pixel alignment if Scale+Translation
1 pixel source padding in all other cases
- Parameters:
- Return type:
- Returns:
An instance of
ReprojectInfo
class.