Hi John, If I may add a bit to the discussion, applying resampling algorithm other than nearest neighbor to thematic layers such as land cover classification is not really recommended. However, if you want to smoothen the edges of your resampling output, I would suggest a two steps approach: - Resample using nearest neighbor. - Apply a majority filter with a large moving window.
I cannot guarantee the result, but I guess it should work. Best regards, Loïc -----Original Message----- From: gdal-dev-boun...@lists.osgeo.org [mailto:gdal-dev-boun...@lists.osgeo.org] On Behalf Of John Twilley Sent: vendredi 27 janvier 2012 20:58 To: Dmitry Baryshnikov Cc: gdal-dev@lists.osgeo.org Subject: Re: [gdal-dev] gdalwarp makes landcover files blocky when shrinking pixel size None of those resampling methods are well-suited to classified rasters as far as I can tell. The method that has worked best in the past was to take the majority of a number of the nearest neighbors. The 'mode' algorithm in gdaladdo may do that, but I haven't checked the source code. Jack. -- mathuin at gmail dot com 2012/1/27 Dmitry Baryshnikov <poli...@mail.ru>: > 27.01.2012 23:30, John Twilley пишет: > >> Cubic is fine for the elevation, but it doesn't work on the landcover. >> which is the problem I originally mentioned. >> >> Jack. >> -- >> mathuin at gmail dot com >> >> >> >> 2012/1/27 Dmitry Baryshnikov<poli...@mail.ru>: >>> >>> 27.01.2012 20:19, John Twilley пишет: >>> >>>> After retrieving the files and building VRTs from them, I run the >>>> following gdalwarp commands: >>>> >>>> gdalwarp -q -multi -t_srs "+proj=aea +datum=NAD83 +lat_1=29.5 >>>> +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +units=m" -tr 6 6 >>>> +-te >>>> 2002944 2271744 2016768 2288640 \ >>>> -srcnodata -340282346638528859811704183484516925440 -dstnodata 0 >>>> ND302HT.vrt ND302HT.tif gdalwarp -q -multi -t_srs "+proj=aea >>>> +datum=NAD83 +lat_1=29.5 >>>> +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +units=m" -tr 6 6 >>>> +-te >>>> 2002944 2271744 2016768 2288640 \ >>>> -srcnodata 255 -dstnodata 11 L0102HT.vrt L0102HT.tif >>>> >>>> The only differences between the lines are the nodata values. >>>> >>>> Jack. >>>> -- >>>> mathuin at gmail dot com >>>> >>>> >>>> >>>> On Thu, Jan 26, 2012 at 22:49, Dmitry Baryshnikov<poli...@mail.ru> >>>> wrote: >>>>> >>>>> 27.01.2012 3:39, John Twilley пишет: >>>>>> >>>>>> I am working with elevation and landcover data downloaded from >>>>>> the USGS. I use gdalwarp to convert the data to a much smaller >>>>>> pixel. The elevation data works very nicely with cubic >>>>>> resampling, but the only resampling that works at all for the >>>>>> landcover data is nearest-neighbor and that's very blocky. When >>>>>> I last worked with landcover data, I used a majority algorithm >>>>>> which produced smoother output -- but that algorithm is not implemented >>>>>> in gdalwarp. >>>>>> I am looking over the source to gdalwarp to see how hard it is to >>>>>> add a new algorithm. Other than that, though, what options are >>>>>> available to me? Thanks in advance! >>>>>> Jack.-- >>>>>> mathuin at gmail dot com >>>>>> _______________________________________________ >>>>>> gdal-dev mailing list >>>>>> gdal-dev@lists.osgeo.org >>>>>> http://lists.osgeo.org/mailman/listinfo/gdal-dev >>>>>> >>>>>> >>>>> Hi John, >>>>> >>>>> That is your command line string for gdalwarp? >>>>> >>>>> Best regards, >>>>> Dmitry >>>>> >>>>> _______________________________________________ >>>>> gdal-dev mailing list >>>>> gdal-dev@lists.osgeo.org >>>>> http://lists.osgeo.org/mailman/listinfo/gdal-dev >>> >>> Hi John, >>> >>> Try to add "-r cubic" command parameter For example: >>> >>> >>> gdalwarp -q -multi -t_srs "+proj=aea +datum=NAD83 +lat_1=29.5 >>> +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +units=m" -tr 6 6 -r cubic >>> -te >>> >>> 2002944 2271744 2016768 2288640 \ >>> -srcnodata -340282346638528859811704183484516925440 -dstnodata 0 >>> ND302HT.vrt ND302HT.tif >>> >>> You can found additional parameters description here: >>> http://www.gdal.org/gdalwarp.html >>> I have tested -r parameter and it works. >>> >>> >>> Best regards, >>> Dmitry >>> >>> >>> _______________________________________________ >>> gdal-dev mailing list >>> gdal-dev@lists.osgeo.org >>> http://lists.osgeo.org/mailman/listinfo/gdal-dev >> >> > Hi John, > You can use resampling methods: > near: nearest neighbour resampling (default, fastest algorithm, worst > interpolation quality). > bilinear: bilinear resampling. > cubic: cubic resampling. > cubicspline: cubic spline resampling. > lanczos: Lanczos windowed sinc resampling. > > And what method do you need? > > > Best regards, > Dmitry > _______________________________________________ > gdal-dev mailing list > gdal-dev@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/gdal-dev _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev