[Gdal-dev] gdal newbie-merge geotiff images

Ken Boss Ken.Boss at dnr.state.mn.us
Thu Nov 16 10:20:41 EST 2006


Hello Izzy--

If using gdal_merge.py, you can simply specify the nodata value on the
command line with the -n option.  So if those black background pixels
are all zeroes, just add -n 0 to your command line.

I would point out, though, that tiff images are limited to a maximum of
4 GB, and that gdal_merge.py reads entire input images into memory, so
you may be constrained by one or both of these.

gdalwarp is likely the better option.  There you can use the -srcnodata
option to specify the nodata value(s) to be ignored from the input
images.  If you're working with a limited number of images, you might
obtain the bounding boxes for the images using the gdalinfo utility.

HTH,

--Ken

>>> Izzy <izzybitsie at gmail.com> 11/15/2006 2:56:47 PM >>>
I am trying to stitch together several satellite geotiff images to
obtain a
world image.
The individual images display the satellite picture with black areas on
the
sides of the picture itself.
So, when merging the images using gdal_merge.py some pictures are
hidden
underneath the black portion of neighbour images.  Couldn't use -pct
option
due to images characteristics. Pls. see below the color tables in the
input
images.

The original images do not have a no-data value assigned to pixels to
avoid
copying them.
So, for now my only option would be to crop the black areas that are
always
the same size around the image.  I am trying to do this using gdalwarp,
but
I still can't figure out how to obtain the georeferenced box to be
used
along with -projwin option.

BTW.  I haven't been able to see these images using OpenEV although I
can
see them with ImageMagick.  Any idea on what I may be doing wrong in
OpenEV?  I do need to run openev with the "-h" option since it quits on
me
when opening an image otherwise.  I have been able to see other
geotiffs
downloaded from Internet in openev though.

Any help on how to cut the black areas is appreciated.



Some info on 2 of the input images and the output images:

Input number 1

Origin = (45.833333,75.000000)
Pixel Size = (0.08055556,-0.08055556)
Metadata:
  AREA_OR_POINT=Area
Corner Coordinates:
Upper Left  (  45.8333333,  75.0000000) (142d30'0.03"E,  0d 0'0.04"N)
Lower Left  (  45.8333333, -70.0000000) (142d30'0.03"E,  0d 0'0.04"S)
Upper Right (     239.167,      75.000) (142d30'0.14"E,  0d 0'0.04"N)
Lower Right (     239.167,     -70.000) (142d30'0.14"E,  0d 0'0.04"S)
Center      ( 142.5000000,   2.5000000) (142d30'0.08"E,  0d 0'0.00"N)
Band 1 Block=2400x3 Type=Byte, ColorInterp=Palette
  Color Table (RGB with 256 entries)
    0: 0,0,0,255
    1: 0,0,0,255
    2: 0,0,0,255
    3: 0,0,0,255
    4: 0,0,0,255
    5: 0,0,0,255
    6: 0,0,0,255
    7: 0,0,0,255
    8: 0,0,0,255
    9: 0,0,0,255
   10: 0,0,0,255
   11: 0,0,0,255
   12: 0,0,0,255
   13: 0,0,0,255
   14: 0,0,0,255
   15: 0,0,0,255
   16: 0,0,0,255
   17: 0,0,0,255
   18: 0,0,0,255
   19: 0,0,0,255
   20: 0,0,0,255
...............................................................rest of
values in color table look the same

Input number 2
Driver: GTiff/GeoTIFF
Size is 2400, 1800
Coordinate System is:
PROJCS["unnamed",
    GEOGCS["unnamed",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.2572235629972,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0],
        UNIT[,0.0174532925199433]],
    PROJECTION["Equirectangular"],
    PARAMETER["latitude_of_origin",2.5],
    PARAMETER["central_meridian",-155],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["degree",0.01745329251994328,
        AUTHORITY["EPSG","9102"]]]
Origin = (-251.537842,74.963768)
Pixel Size = (0.08051530,-0.08051530)
Metadata:
  AREA_OR_POINT=Area
Corner Coordinates:
Upper Left  (    -251.538,      74.964) (155d 0'0.14"W,  0d 0'0.04"N)
Lower Left  (    -251.538,     -69.964) (155d 0'0.14"W,  0d 0'0.04"S)
Upper Right ( -58.3011272,  74.9637681) (155d 0'0.03"W,  0d 0'0.04"N)
Lower Right ( -58.3011272, -69.9637681) (155d 0'0.03"W,  0d 0'0.04"S)
Center      (-154.9194847,   2.5000000) (155d 0'0.09"W,  0d 0'0.00"N)
Band 1 Block=2400x3 Type=Byte, ColorInterp=Palette
  Color Table (RGB with 256 entries)
    0: 0,0,0,255
    1: 0,0,0,255
    2: 0,0,0,255
    3: 0,0,0,255
    4: 0,0,0,255
    5: 0,0,0,255
    6: 0,0,0,255
    7: 0,0,0,255
    8: 0,0,0,255
    9: 0,0,0,255
   10: 0,0,0,255
   11: 0,0,0,255
   12: 0,0,0,255
   13: 0,0,0,255
   14: 0,0,0,255
   15: 0,0,0,255
   16: 0,0,0,255
   17: 0,0,0,255
   18: 0,0,0,255
   19: 0,0,0,255
   20: 0,0,0,255
.................................................................. rest
of
values in color table look the same


Output from gdal_merge.py -o <outpiut> <Input number 1>  <Input number
2>
Driver: GTiff/GeoTIFF
Size is 6067, 1800
Coordinate System is:
PROJCS["unnamed",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.2572235629972,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Equirectangular"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",135],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["unknown",1]]
Origin = (-243.264249,69.948187)
Pixel Size = (0.07772021,-0.07772021)
Metadata:
  AREA_OR_POINT=Area
Corner Coordinates:
Upper Left  (    -243.264,      69.948) (134d59'52.13"E,  0d 0'2.28"N)
Lower Left  (    -243.264,     -69.948) (134d59'52.13"E,  0d 0'2.28"S)
Upper Right (     228.264,      69.948) (135d 0'7.38"E,  0d 0'2.28"N)
Lower Right (     228.264,     -69.948) (135d 0'7.38"E,  0d 0'2.28"S)
Center      (  -7.5000000,  -0.0000000) (134d59'59.76"E,  0d 0'0.00"S)
Band 1 Block=6067x1 Type=Byte, ColorInterp=Gray



More information about the Gdal-dev mailing list