Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

Thanks for any help!

Kind Regards DomR

share|improve this question
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 Jul 23 '12 at 13:05
All layers contain information on landcover which is supposed to be analyzed over time (so changes between the different layers). –  DomR Jul 23 '12 at 13:29
add comment

1 Answer

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.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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