Hello,

I am trying to resample a .tif raster in C# GDAL in a way that every other cell 
in a row and column is removed.

Something similar to the lower GDAL command:

    gdal_translate -outsize 50% 0 input.tif output.tif

But this command creates a new resampled .tif file.
While I would like to avoid saving a new .tif file, and if possible just 
resample the dataset.

It looks like this can be achieved by the use of VRT 
file<http://www.gdal.org/gdal_vrttut.html>.

Here is one example of a .vrt file, which resamples the .tif file by removing 
the every other cell:


<VRTDataset rasterXSize="42" rasterYSize="32">
  <GeoTransform>14.3779166666, 0.000833333333333, 0.0, 40.8404166667, 0.0, 
-0.000833333333333</GeoTransform>
  <VRTRasterBand dataType="Byte" band="1">
    <ColorInterp>Gray</ColorInterp>
    <SimpleSource resampling="bilinear">
      <SourceFilename relativeToVRT="1">vesuvius_wgs84.tif</SourceFilename>
      <SourceBand>1</SourceBand>
      <SrcRect xOff="0" yOff="0" xSize="85" ySize="65"/>
      <DstRect xOff="0" yOff="0" xSize="42" ySize="32"/>
    </SimpleSource>
  </VRTRasterBand>
</VRTDataset>


What I noticed is that resolution of the resampled dataset does not change in 
comparison to the original dataset.

In this case it remains the 0.00083 degrees.
The same thing happens if I reproject the .tif file to some projected 
coordinate system (UTM for example): resolution remains the same (70 meters for 
example).

Why is this the case?

Shouldn't the resolution of the resampled dataset be twice of the resolution of 
the original (non-resampled) dataset, based on the fact that every other cell 
is removed (original dataset: 85x65, resampled dataset: 42x32)?


I would be very grateful if I could get any kind of reply.

Thank you in advance.

With kind regards,
Didier
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to