What it is

landmerge is a (commandline) Landsat imagery processor.

What is Landsat

"The Landsat Program is a series of Earth-observing satellite missions jointly managed by NASA and the U.S. Geological Survey. Since 1972, Landsat satellites have collected information about Earth from space." [1]. This information is represented mainly as (monochromatic) images of Earth's surface, covering various spectral bands and coming in several different spatial resolutions (depending on wavelength). We will be interested in the Landsat 7 satellite only, which features the ETM+ sensor, providing images in the following spectral bands:

BandNameλ/nmm per pixel
1.Blue450 – 51528.5
2.Green525 – 60528.5
3.Red630 – 69028.5
4.Near IR760 – 90028.5
5.Mid IR1550 – 175028.5
61.Thermal (hi-gain)10400 – 1250057
62.Thermal (lo-gain)10400 – 1250057
7.Mid IR2080 – 235028.5
8.Panchromatic520 – 92014.25
Table 1: Landsat 7 (ETM+) bands, according to [3].

The projection used in all images is UTM, according to the corresponding zone.

Imagery produced by Landsat is currently being released for free download to the public [2]. (All data landmerge downloads comes from the FTP server of Global Land Cover Facility.)

What is landmerge

Raw Landsat imagery is unsuitable for direct viewing. Earth's surface is divided into scenes — roughly square areas, sized ~ 180km x 180km. For each scene, there are nine monochromatic images (one for each band), each being around 20MB (4000x4000 px, band 6), 70MB (8000x8000 px, most bands), and 280MB (16000x16000 px, band 8) in size. What's more, valid scene data constitutes only a tilted square in the center of the image; the rest of the image is black.

Another issue we want to solve is colors and resolution. If we wanted a naturally-looking image, there are red, green, and blue bands (1., 2., 3.). However, these images provide low resolution — 28.5 m/px. The panchromatic band shares a large part with the visible portion of the spectrum and by combining it with the other bands, we could reconstruct a high-resolution (14.25 m/px), naturally-looking image (this is known as pan sharpening).

Note that pan sharpening is not conventional sharpening (as in Gimp/Photoshop); it indeed makes use of additional information from different bands to reconstruct a high-res image.

Unsharpened image Pan-sharpened image
Figure 2: Comparison of an unsharpened and a pan-sharpened image of the same area.

The image data is accompanied by metadata — information about projection of the images onto Earth's surface. This is needed to calculate which images are to be downloaded and which parts of the images need to be extracted and used to reconstruct the final image.

Finally, we need an automated way to download data from the Internet, perform needed calculations, extract relevant portions of the downloaded data (images), pan-sharpen them, and eventually stitch them into a single image, hiding the complicated background (multiple not-fully-covered large monochromatic images) from the user, providing them with a single high-resolution, natural-looking image in a common file format.

And this is exactly what landmerge does. Needing minimal input (and effort) from the user — geographical position & image dimensions suffice, it performs everything needed automatically behind the scenes.

landmerge has some advantages over common web map services — it was designed to be included in larger automated toolchains (which is problematic otherwise). Furthermore, Landsat is another independent imagery source, which can be useful if the other ones are not accessible at the moment (or for verification). A disadvantage is its (even after pan-sharpening) low resolution (when compared to Google Maps, for example).


System requirements

It should not be too hard to port on Windows; I have never tried to, though.

Brief guide

Download and installation

Download and unpack the source code:

$ wget http://blackhole.sk/~ziman/landmerge/landmerge-1.0.12.tar.bz2
$ tar -xvjf landmerge-1.0.12.tar.bz2
$ cd landmerge-1.0.12.tar.bz2/

No manual compilation is needed. The native utilities in src/ will be compiled automatically on the first run. However, you can issue make -C src/ if you really want to.


Basic usage is very simple. Suppose you wanted a 10x10 km image, centered at 49°N, 21°15'E.

./landmerge -A 10x10@49,21.25 --units km-deg

This will output some progress information and finally create outfile.png containing the final image.

An example of a more advanced use would be:

./landmerge -z 34 -A 10x10@510,5010 -u km-utm -t 2 -o myimage.jpg -c 3

This commandline specifies UTM zone 34, 10x10 km area at 490 km easting, 5010 km northing in kilometer UTM coordinates. Processing will run in parallel using two threads, writing output to myimage.jpg. Overcrop is set to 3 pixels.

Commandline options:

A listing of commandline options follows:

Specifies the (geographical) position of the desired image. WIDTH, HEIGHT are the (geographical) dimensions of the image, X,Y are coordinates of the top-left corner of the image, either
  • easting,northing with --units m-utm or km-utm
  • latitude,longitude with --units m-deg or km-deg.
The same as -a except that X,Y specify the center of the area.
Specifies the UTM zone (and therefore the projection of the image). Required in --units *-utm mode, optional (as hint) in --units *-deg mode.
Output file name; its format is specified by the extension. Available formats: *.jpg, *.png, *.raw.
Default: outfile.png
(JPG only). JPEG quality (1 = worst, 100 = finest).
Default: 75
-t N
How many merge merge processes to run in parallel.
Default: 2
Use the old merge program instead of the regular one. Produces fancier albeit unrealistic images.
-p Q
In order to create (false) plasticity in the resulting image, panchromatic channel can be mixed into it. Value of 0 means no mixing will be done, 1 means the output will be completely replaced by the panchromatic image.
Default: 0.0
-c N
Overcrop the scene quadrilateral by this many pixels (along each side). This is a workaround eliminating visible seams in the images (which seem to be caused by imprecise scene coords or rounding errors, the reason is not really known). I've come across scenes needing -c 5. :-\
Default: 2
-u UNITS *OR* --units UNITS
One of m-utm, km-utm, m-deg, km-deg.
  • km-deg — Dimensions in km, angular (@latitude,longitude) position.
  • m-deg — Dimensions in m, angular (@latitude,longitude) position.
  • km-utm — Everything in kilometers (UTM, @easting,northing).
  • m-utm — Everything in meters (UTM, @easting,northing).
Default: m-utm (hysterical raisins).

Fish & tips

Bugs & issues

Bugs are managed using project's issue tracker on Google Code.


This is my bachelor's project. You can get the thesis (Slovak only).

I do not give any information here on how the application works internally. If you are interested (and don't speak Slovak so you cannot read the thesis), just e-mail me.


Feel free to write any questions/feedback to my e-mail address: ziman@centrum.sk.


  1. The Landsat Program at NASA.gov
  2. Imagery for Everyone (PDF)
  3. Landsat Technical Guide