4

I need to merge different raster datasets which have one layer and contain discrete values to a layer stack. The resolutions of the data can have any value so not only multiples of the resolutions from the other input rasters thus there are problems with alignment. Also the corner coordinates are not necessarily identical.

Has anybody got a creative idea of what is the best way to do the merging without losing information as a layer stack can only have layers with the same resolution? I have used gdal_merge.py and of course there is quite some loss of information through the nearest neighbour resampling (though I must use nearest neighbour as I want to keep discrete values).

One thing I thought of was to polygonize each raster and then union them and rasterize the resuling polygon with a appropriate resolution. That would keep most information but here I am afraid that it will not work properly with large datasets. Perhaps somebody has experience with this?

2
  • What is the purpose of the merge? Usually a stack is a preliminary to performing additional data analysis. Different forms of analysis will determine what is and is not appropriate for the resampling of these rasters.
    – whuber
    Commented Jul 23, 2012 at 13:05
  • 1
    All layers contain information on landcover which is supposed to be analyzed over time (so changes between the different layers).
    – DomR
    Commented Jul 23, 2012 at 13:29

1 Answer 1

4

No need to turn the raster into polygons.

You'll want to do it in multiple passes. First you want to resample the lower resolution dataset to as close as you can get and a multiple of the higher resolution dataset using bilinear interpolation which should get you a better looking resampling. Then do the merge as normal using your nearest neighbor (which I think gdal_merge.py can only do anyways).

For the first step you'd need to use gdalwarp with the -r bilinear or -r cubic option. This will get you a decent resampling to continue on with your merge. gdalwarp can also do the nearest neighbor if you wanted to use that in your second pass.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.