how to save a SRTM/HGT file after a mosaic

377 views
Skip to first unread message

Maximilian

unread,
Mar 26, 2008, 1:29:03 PM3/26/08
to mirone
I am looking for a free software that helps me to merge (or mosaic) 2,
4 or more hgt files (downloaded from NASA website) in one final "big"
file. This is the only thing I need to do....

MIRONE does this in a great way (and it does many other things far
away from my aim!) via Grid tools, plotting the new terrain.

But I want to save this new - big - hgt file, and MIRONE says <<grid
does not cover 1° square>>. What can I do ? Where is the problem? I
used the option SRTM Tools -> save as SRTM but without success. I
need the output in a hgt format...

Thank-you for the support and for any suggestion.

jluis

unread,
Mar 26, 2008, 1:52:11 PM3/26/08
to mirone


On Mar 26, 5:29 pm, Maximilian <maximilian.arp...@gmail.com> wrote:
> I am looking for a free software that helps me to merge (or mosaic) 2,
> 4 or more hgt files (downloaded from NASA website)  in one final "big"
> file. This is the only thing I need to do....

You may want to take a look here (they have already done it)

> But I want to save this new - big - hgt file, and MIRONE  says <<grid
> does not cover 1° square>>.  What can I do ? Where is the problem? I
> used the option SRTM Tools -> save as SRTM but without success.

SRTM tiles follow a specific nomenclature based on their lower left
corner coordinates and cover 1º degree. If you mosaic it them then it
is no longer possible to stick to the definition. That is why you get
that message. The other reason is because I never thought on that
before.
The .hgt format doesn't really deserve that credit of being a "format"
IMHO it exists because there are people that like to invent "new
formats" for nothing.
I'm not absolutely sure on this (didn't check) but I'm persuaded that
it is the same as the one you get from "Save Grid As ... -> ESRI .hdr
labelled". The extension is meaningless for the file is in what is
more known as "raw" format. That is no header and the matrix is
written from lower left corner by rows (first, bottom row next the
second bottom row ... and so on)

> I need the output in a hgt format...

Any good reason for that?

Best regards
Joaquim Luis

jluis

unread,
Mar 26, 2008, 2:03:11 PM3/26/08
to mirone
Hoops. I forgot the link

> You may want to take a look here (they have already done it)

http://srtm.csi.cgiar.org/SELECTION/inputCoord.asp

Agustan

unread,
May 21, 2008, 10:59:06 PM5/21/08
to mirone
Previously I also have the same problem, to solve myneed of the 'big'
SRTM data, i found 3 methods can work. However the output of the last
2 methods is not hgt file.

1. from http://www.uoregon.edu/~das/WikiRoiPac/doku.php?id=roipac:srtm
i.e.
% read 30m SRTM DEMs

fid=fopen(’N37W122o.hgt’);
B1=fread(fid,[3601 3601],’int16’);
fclose(fid);

fid=fopen(’N37W123o.hgt’);
B2=fread(fid,[3601 3601],’int16’);
fclose(fid);

fid=fopen(’N38W122o.hgt’);
B3=fread(fid,[3601 3601],’int16’);
fclose(fid);

fid=fopen(’N38W123o.hgt’);
B4=fread(fid,[3601 3601],’int16’);
fclose(fid);

% mosaic tiles
B=[B4’ B3’;B2’ B1’];

% delete overlapping row and column
B(3601,:)=[];
B(:,3601)=[];

% replace bad data points
jj=find(B==-32768);
B(jj)=NaN;

% view result
imagesc(B);

Using the output figure you can check to make sure the files are in
the right order. If so, use the following Matlab commands to save the
file:

% write output file
fid=fopen(’bayarea.dem’,’w’);
fwrite(fid,B’,’int16’);
fclose(fid);

2. Using GMT which is explained in
http://able1.mines.unr.edu/Geophysics_website/701h_Radar_Fall03/Radar_F03_lab_guide_26Aug03/ROI_PAC_DOCs/ROI_PAC.02.3.27_chris_okubo_reduced_resolution.pdf
i.e.

unzip N38W110.hgt.zip
grdraster 1 -R-110/-109/38/39 -I1c -GN38W110.grd -V
rm *hgt
unzip N37W110.hgt.zip
grdraster 2 -R-110/-109/37/38 -I1c -GN37W110.grd -V
rm *hgt
grdpaste N38W110.grd N37W110.grd -Ginter_110_109.grd -V
rm N38W110.grd N37W110.grd
unzip N38W111.hgt.zip
grdraster 3 -R-111/-110/38/39 -I1c -GN38W111.grd -V
rm *hgt
unzip N37W111.hgt.zip
grdraster 4 -R-111/-110/37/38 -I1c -GN37W111.grd -V
rm *hgt
grdpaste N38W111.grd N37W111.grd -Ginter_111_110.grd -V
rm N38W111.grd N37W111.grd
grdpaste inter_110_109.grd inter_111_110.grd –Gcanyonlands_all.grd -V
rm inter_110_109.grd inter_111_110.grd
grdcut canyonlands_all.grd -R–110.5/-109.5/37.5/38.5 –
Gcanyonlands_sub.grd
grd2xyz canyonlands_sub.grd >canyonlands_sub.xyz –S –V
surface canyonlands_sub.xyz –I1c -R–110.5/-109.5/37.5/38.5 –
Gcanyonlands.grd –T0.35 -V
grd2cpt -Crainbow canyonlands.grd >canyonlands.cpt -V
grdgradient canyonlands.grd -A0/270 -Gcanyonlands_grad.grd -Ne0.6 -V
grdimage canyonlands.grd -JM16c -Icanyonlands_grad.grd -P -V -R–
110.5/-109.5/37.5/38.5 -Ccanyonlands.cpt >canyonlands.eps
grd2xyz canyonlands.grd >canyonlands.dem –ZTLh –V

3. Using MIRONE SRTM-tile and then save to GMT grid file.

regards,
agustan
Reply all
Reply to author
Forward
0 new messages