Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to figure out how to merge adjacent raster datasets. Is there any clear algorithms (may be a pseudo code)?

share|improve this question
How are you determining the source raster? Is it a selected raster, from a list, all in a directory, etc.? – Ryan Garnett Mar 27 '13 at 22:38
It's a collection of JPG images in one directory. each of them has a world file (.jpgw) and a projection file (.prj). – lio Mar 27 '13 at 22:53
Do you want to find the rasters on all potential sides (ie: 4 sides along the raster edge) – Ryan Garnett Mar 27 '13 at 23:20
yes, it's the situation what I'm dealing with. It's some kind of mosaiced images that i want to merge in one image. – lio Mar 27 '13 at 23:34

Well if you are looking to merge all the images from a folder you can do a two step process.

1) Use command prompt to make a directory list file [ dir c:\temp\*.jpg /b /s >c:\temp\imagelist.txt ]

2) Using FWTools run gdal_merge [ gdal_merge -o c:\temp\mosaic.tif -q -v --optfile c:\temp\imagelist.txt ]

This will make a file of all the images in a directory, and then mosaic the files into an output file.

share|improve this answer
Thank you very much, What I was searching for is an algorithm to embed in my gis application. However, this tool seems to be useful and suits my needs. Thank you – lio Mar 28 '13 at 3:36
GDAL can be accessed through its C / C++ API, or the bindings which exist for it in numerous languages. – scw Mar 28 '13 at 7:54

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.