Set the Scale XML tag for a VRT_x object. This information is preserved in derived VRT and GeoTIFF files.
Examples
s2files <- fs::dir_ls(system.file("s2-data", package = "vrtility"))
ex_collect <- vrt_collect(s2files)
ex_sc1 <- vrt_set_scale(
ex_collect,
scale_value = 1e-4
)
print(ex_sc1[[1]][[1]], xml = TRUE)
#> → <VRT Block>
#> VRT XML:
#>
#> <?xml version="1.0" encoding="UTF-8"?>
#> <VRTDataset rasterXSize="354" rasterYSize="334">
#> <SRS dataAxisToSRSAxisMapping="1,2">PROJCS["unknown",GEOGCS["unknown",DATUM["Unknown based on WGS 84 ellipsoid",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]]],PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["latitude_of_center",50.72],PARAMETER["longitude_of_center",-3.51],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1],AXIS["Easting",EAST],AXIS["Northing",NORTH]]</SRS>
#> <GeoTransform> -3.5400000000000000e+03, 2.0000000000000000e+01, 0.0000000000000000e+00, 3.3400000000000000e+03, 0.0000000000000000e+00, -2.0000000000000000e+01</GeoTransform>
#> <VRTRasterBand dataType="UInt16" band="1">
#> <NoDataValue>0</NoDataValue>
#> <ColorInterp>Gray</ColorInterp>
#> <ComplexSource>
#> <SourceFilename relativeToVRT="0">/home/runner/work/_temp/Library/vrtility/s2-data/exe_2024-06-02_12-21-19.tif</SourceFilename>
#> <SourceBand>1</SourceBand>
#> <SourceProperties RasterXSize="354" RasterYSize="334" DataType="UInt16" BlockXSize="256" BlockYSize="256"/>
#> <SrcRect xOff="0" yOff="0" xSize="354" ySize="334"/>
#> <DstRect xOff="0" yOff="0" xSize="354" ySize="334"/>
#> <NODATA>0</NODATA>
#> </ComplexSource>
#> <Description>B02</Description>
#> <Scale>0.0001</Scale>
#> </VRTRasterBand>
#> <VRTRasterBand dataType="UInt16" band="2">
#> <NoDataValue>0</NoDataValue>
#> <ComplexSource>
#> <SourceFilename relativeToVRT="0">/home/runner/work/_temp/Library/vrtility/s2-data/exe_2024-06-02_12-21-19.tif</SourceFilename>
#> <SourceBand>2</SourceBand>
#> <SourceProperties RasterXSize="354" RasterYSize="334" DataType="UInt16" BlockXSize="256" BlockYSize="256"/>
#> <SrcRect xOff="0" yOff="0" xSize="354" ySize="334"/>
#> <DstRect xOff="0" yOff="0" xSize="354" ySize="334"/>
#> <NODATA>0</NODATA>
#> </ComplexSource>
#> <Description>B03</Description>
#> <Scale>0.0001</Scale>
#> </VRTRasterBand>
#> <VRTRasterBand dataType="UInt16" band="3">
#> <NoDataValue>0</NoDataValue>
#> <ComplexSource>
#> <SourceFilename relativeToVRT="0">/home/runner/work/_temp/Library/vrtility/s2-data/exe_2024-06-02_12-21-19.tif</SourceFilename>
#> <SourceBand>3</SourceBand>
#> <SourceProperties RasterXSize="354" RasterYSize="334" DataType="UInt16" BlockXSize="256" BlockYSize="256"/>
#> <SrcRect xOff="0" yOff="0" xSize="354" ySize="334"/>
#> <DstRect xOff="0" yOff="0" xSize="354" ySize="334"/>
#> <NODATA>0</NODATA>
#> </ComplexSource>
#> <Description>B04</Description>
#> <Scale>0.0001</Scale>
#> </VRTRasterBand>
#> <VRTRasterBand dataType="UInt16" band="4">
#> <NoDataValue>0</NoDataValue>
#> <ComplexSource>
#> <SourceFilename relativeToVRT="0">/home/runner/work/_temp/Library/vrtility/s2-data/exe_2024-06-02_12-21-19.tif</SourceFilename>
#> <SourceBand>4</SourceBand>
#> <SourceProperties RasterXSize="354" RasterYSize="334" DataType="UInt16" BlockXSize="256" BlockYSize="256"/>
#> <SrcRect xOff="0" yOff="0" xSize="354" ySize="334"/>
#> <DstRect xOff="0" yOff="0" xSize="354" ySize="334"/>
#> <NODATA>0</NODATA>
#> </ComplexSource>
#> <Description>SCL</Description>
#> <Scale>0.0001</Scale>
#> </VRTRasterBand>
#> <Metadata>
#> <MDI key="datetime"/>
#> </Metadata>
#> </VRTDataset>
#>
#>
#>
#> VRT SRS:
#> PROJCS["unknown",GEOGCS["unknown",DATUM["Unknown based on WGS 84 ellipsoid",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]]],PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["latitude_of_center",50.72],PARAMETER["longitude_of_center",-3.51],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1],AXIS["Easting",EAST],AXIS["Northing",NORTH]]
#>
#>
#> Bounding Box: -3540 -3340 3540 3340
#> Pixel res: 20, 20
#> Assets: B02, B03, B04, SCL
#> No Data Value(s): 0, 0, 0, 0
#> Date Time: NA