3

I'm trying to create an elevation map using the output from gdal_translate. When I run gdal I can convert to both PNG and ENVI and combine the results to make something like the following image.

Mt. Rainier

Here's the command I use:
gdal_translate -of PNG -scale 23.000 4367.000 0 256 Rainier.tif Rainier.png
gdal_translate -of ENVI -scale 23.000 4367.000 0 256 Rainier.tif Rainier.bin

That's great. In fact it's exactly the result that I want, except for one thing, I want to be able to specify an outsize. Let's say that I want the image to be 200x200.

Here's the command I use:
gdal_translate -of PNG -scale 23.000 4367.000 0 256 -outsize 200 200 Rainier.tif Rainier.png
gdal_translate -of ENVI -scale 23.000 4367.000 0 256 -outsize 200 200 Rainier.tif Rainier.bin

The PNG image turns out the way that I expect but when I try to utilize the ENVI map to change the elevation it gives me an unexpected result.

Not Mt. Ranier

Is gdal_translate -outsize broken for ENVI? or am I doing something wrong?

edit: Adding image of the results after using -r lanczos while scaling in gdalwarp Mt. Rainier with Lanczos resampling

  • 2
    what is your input size (gdalinfo) ? this looks like a resampling artefact due to very different X and Y pixel size. – radouxju Jul 23 '15 at 6:04
  • As @radouxju said, perhaps it would be better to specify -r bilinear (or lanczos or average).. it looks like the default nearest resampling method is causing some issues. – Michael Stimson Jul 23 '15 at 6:46
  • The input size is 446x325 Pixel Size = (0.002081390134529,-0.002081230769231) I'll try using -r bilinear (or other) and report back. – Braden Roseborough Jul 23 '15 at 16:17
  • Turns out gdal_translate doesn't have the -r flag, so I tried resizing the tif using gdalwarp and -r bilinear before using gdal_translate to turn it into a PNG or ENVI file. I also tried average and lanczos. The results were still messed up but now there's a peak on either edge of the tile that might match the peak that's supposed to be in the center? I'll add the image to the original question so you can see it. Do you think it could be offset for some reason? – Braden Roseborough Jul 23 '15 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.