hypertidy / vapour

GDAL API package for R
https://hypertidy.github.io/vapour/
83 stars 9 forks source link

warped vrt example to remind me of issues #210

Closed mdsumner closed 1 year ago

mdsumner commented 1 year ago

this source from GDAL issue #7750 contains three tifs

dsn <- "/vsizip/vsicurl/https://github.com/OSGeo/gdal/files/11456293/data.zip"
(tifs <- file.path(dsn, vapour::vapour_vsi_list(dsn)))

[1] "/vsizip/vsicurl/https://github.com/OSGeo/gdal/files/11456293/data.zip/latitude.tif" 
[2] "/vsizip/vsicurl/https://github.com/OSGeo/gdal/files/11456293/data.zip/longitude.tif"
[3] "/vsizip/vsicurl/https://github.com/OSGeo/gdal/files/11456293/data.zip/testdata.tif"

so, we create a VRT but it won't work without also setting '-geoloc' option when the warper runs, because the source has a geotransform.

vrt <- vapour::vapour_vrt(tifs[3], geolocation = tifs[2:1])

So consider fixing that, to scrub the geotransform from a vapour_vrt(, geolocation = )

When all that's done it works in the usual way

ximage::ximage(vapour::gdal_raster_data(tifs[3]), asp = 1)
ximage::ximage(vapour::gdal_raster_data(vrt, options = c("-geoloc")), asp = 1/cos(53 * pi/180))

image

mdsumner commented 1 year ago

fixed in R code (remove the '' element) because zeroing out the transform didn't work ... ?