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

Ari Jolma ari.jolma at tkk.fi
Wed May 30 14:20:41 EDT 2007


Tomas R kirjoitti:
> 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.

Sounds like you simply need ReadRaster (in original size) and 
WriteRaster (in a new size) and do the interpolation in between and 
create/open/flush/close around.

At least that's the simple man's approach...

Ari


> 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?
>
> Why use GDAL? Well I have a method using what is available in C# but 
> it requires a an image in a format C# can read and it also requires me 
> to load whole image to memory. Gdal seems to be able to parse the file 
> and why not make use of Gdal when possible?
>
> Yours
> Tomas
>
> Tamas Szekeres skrev:
>> Tomas,
>>
>> Currently the interface has only a limited support to this effort.
>> Some time ago the only option I've found have been described at this
>> ticket:
>>
>> http://trac.osgeo.org/gdal/ticket/1469
>>
>> However I had to apply a patch to make this feature work and I don't
>> know exactly whether it have eventually been fixed or not. I'd
>> appreciate you to make a test, and provide the comment about the
>> results to this ticket.
>>
>>
>> Best regards,
>>
>> Tamas
>>
>>
>> 2007/5/29, Tomas R <monshi at home.se>:
>>> Questions, questions. Hope someone will answer..
>>>
>>> Short one:
>>> Is it possible from C# to make use of GDAL to resample a map?  Like
>>> GDALWarp can do from the commandline?
>>>
>>> Example?
>>>
>>> Yours
>>> Tomas
>>>
>>> _______________________________________________
>>> Gdal-dev mailing list
>>> Gdal-dev at lists.maptools.org
>>> http://lists.maptools.org/mailman/listinfo/gdal-dev
>>>
>
>
> _______________________________________________
> Gdal-dev mailing list
> Gdal-dev at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/gdal-dev





More information about the Gdal-dev mailing list