terensis / eodal_basetiffs_GPL3

A simple data backend for acquiring optical satellite data based on EOdal
GNU General Public License v3.0
0 stars 0 forks source link

Use dst_transform when reprojecting data in target CRS #10

Closed lukasValentin closed 11 months ago

lukasValentin commented 11 months ago

We should ensure to set the dst_transform when reprojected scenes into a target CRS to control the reprojection behavior, using an explicit Affine transform:


from rasterio import Affine

# minx, maxy: upper left corner coordinate in target CRS
# we have to take them from the `geo_info` of the original dataset and reproject it to the target CRS first, using
# e.g., geopandas
minx, maxy = ...

dst_transform = Affine(
    a=orig_geo_info.pixres_x,   # enforce the same pixel size as in the original scene
    b=0,
    c=minx,
    d=0,
    e=orig_geo_info.pixres_y,   # enforce the same pixel size as in the original scene
    f=maxy)
lukasValentin commented 11 months ago

@gperich could you have a look?

lukasValentin commented 11 months ago

After thinking a bit more about it, I think we shouldn't do it as the system would break once we leave a projected coordinate system and go to geographic coordinate systems such as WGS84