[Gdal-dev] Re: Resample map from C#

Frank Warmerdam warmerdam at pobox.com
Wed May 30 12:59:49 EDT 2007


Tomas R wrote:
> I ran the code together with the image in the ticket and nothing 
> happened to the picture.
> 
> But I'm not sure if I am on the right track.
> 
> What I would like to do is not reproject the map in anyway. What I am 
> after is a possibility to down sample an image/a map using some good 
> interpolations technique. My guess is that all I need is the last line 
> in the code in the example in the ticket:
>> Dataset dsw = drv_out.CreateCopy("CTest.tif", ds, 0, new string[] { 
>> "INTERLEAVE=PIXEL",   null });
> where I in the string is to provide the interpolation method and the 
> size of the copy to save. How to format this string - I haven't got  
> clue! Or actually, not even how to format the command line call to 
> GDalwarp to use, for example, cubic splines. The correct documentation 
> is not easy to find. The doc about gdalwarp options found here:
> http://www.gdal.org/gdalwarp.html
> doesn't seem to up to date.
> Or am I totally of track?

Tomas,

The CreateCopy() method does not provide options to control the resampling
mechanism.  In fact, it copies it's source dataset at 1:1 so there is
no resampling.  If the source is a virtual dataset that downsamples some
other file, you would in theory need to pass the resampling type to the
VRT file.  *But* VRT files do not support any resampling type other than
that provided by GDALRasterIO() which is nearest neighbour.

Currently, in GDAL, only the specialized WarpAPI provides resampling
other than nearest neighbour.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list