Results 1 to 10 of 18

Thread: [Award Winner] Managing SRTM information with GDAL

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Guild Novice vehrka's Avatar
    Join Date
    Mar 2009
    Location
    Valencia, Spain
    Posts
    19

    Post

    3.-Joinning the tiles.

    We're going to use gdal_merge for joinning the tiles, it's a console apllication (a command) for joinning raster datasets. I you type:

    Code:
    gdal_merge
    you will get a lot of information about this command, but I'm just getting to the meat of the matter:

    If we have four tiles files srtm_36_04.tif, srtm_36_05.tif, srtm_37_04.tif y srtm_37_05.tif; you can join them typping:

    Code:
    gdal_merge -o mosaico.tif srtm_36_04.tif srtm_36_05.tif srtm_37_04.tif srtm_37_05.tif
    After -o comes the name of the output file, after that comes the names of the files, space sepparated; though the desired output format is the same that the standard (GeoTiff) we're not using the -of option.

    4.- Cropping.

    For cropping we are going to use gdalwarp.

    Code:
    gdalwarp -te 626680 4191038 815725 4519394 mosaico.tif mosaico_rer.tif
    after the -te option you must add the area coordinates
    Last edited by vehrka; 05-08-2009 at 03:21 AM.
    --
    vehrka

  2. #2
    Guild Novice vehrka's Avatar
    Join Date
    Mar 2009
    Location
    Valencia, Spain
    Posts
    19

    Post

    5.- Scaling.

    If you use Photoshop this is the end of the mini-tutorial, you can get the final image and start working with it.

    But I use GIMP and we won't get 16bit image support until version 2.8 (if they don't change the milestone again) so I have to scale the images to 8 bits.

    We'll use gdal_translate command for rescaling, but we're also using gdalinfo for getting some info first. With gdalinfo we can get information about the maximum and minimum of the histogram, we will use this information for rescaling to 0~255 greyscale with gdal_translate. For getting the info we type

    Code:
    gdalinfo -hist mosaico_rer.tif
    we are looking for a line wich is similar to " 256 buckets from -32835.4 to 1757". -32835.4 is a way to say NULL or no data, and 1757 is the maximum.

    Code:
    gdal_translate -ot Byte -scale 0 1757 0 255 mosaico_rer.tif mosaico_rer8.tif
    With the -ot option you can set the output data type, we are using 8 bit (1 byte), and again the output format is GeoTiff, the standard one; so we're not using the -of option. With the -scale option you can define the match between the input (0~1757) and output (0~255) range.

    Now you can use the image in GIMP.
    --
    vehrka

  3. #3
    Community Leader Facebook Connected Ascension's Avatar
    Join Date
    Jun 2008
    Location
    St. Charles, Missouri, United States
    Posts
    8,392

    Post

    Good stuff. I was able to follow along and understand even though I have no knowledge of using real world data. I can see this as being very helpful and useful. Good job.
    If the radiance of a thousand suns was to burst at once into the sky, that would be like the splendor of the Mighty One...I am become Death, the Shatterer of worlds.
    -J. Robert Oppenheimer (father of the atom bomb) alluding to The Bhagavad Gita (Chapter 11, Verse 32)


    My Maps ~ My Brushes ~ My Tutorials ~ My Challenge Maps

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •