3.85714

3.9 | 8 ratings Rate this file 18 Downloads (last 30 days) File Size: 2.81 KB File ID: #5544

GetSRTMData

by Sebastian Hölz

 

23 Jul 2004 (Updated 03 Dec 2004)

Extract heigth information from SRTM-files.

| Watch this File

File Information
Description

The function enables you to extract height data from SRTM-files for ...

... a single coordinate
... several coordinates
... a line between two coordinates
... several lines between pairs of coordinates.

The output structure will contain a structure of (lon/lat/height)-triplets depending on the input data.

Easy to use, hope you like it ...

Sebinator

MATLAB release MATLAB 6.5 (R13)
Other requirements - Computer - SRTM-files (-> ftp://e0dps01u.ecs.nasa.gov/srtm/), new address!!!
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (10)
29 Jul 2004 Ralph-Uwe Börner

Doesn't work for me if either lat or lon is an integer, e.g.
>> out=GetSRTMData([13.0,51.21]);
Patch like this:
lon(1) = floor(min(tmp(:,1)));
lon(2) = ceil(0.5+max(tmp(:,1)));
lat(1) = floor(min(tmp(:,2)));
lat(2) = ceil(0.5+max(tmp(:,2)));

However, nice tool!

02 Dec 2004 John Tanner

File called is wrong if long < |10|

Patch using the following code:

if x<=-100; LON = 'W'; elseif x>-100 & x<=-10; LON = 'W0'; elseif x>-10 & x<0; LON = 'W00'; elseif x>=0 & x<10; LON='E00'; elseif x>=10 & x<100; LON='E0'; else; LON='E'; end

It worked for me...it might work for you!

Other than that, a great piece of code, well done Sebinator.

20 Jan 2006 André Lutz

Still a little problem:
Line 95: elseif x> 10 & x<100; LON = 'E0';
replace by: elseif x>=10 & x<100; LON = 'E0';

06 Mar 2006 MEFTAH ELHADI  
14 Jun 2006 Olaf Grossebaffe

You may use something like that

if x<0; LON = 'W' ;
else; LON = 'E' ;
end
if y<0; LAT = 'S' ;
else; LAT = 'N' ;
end
filename=[path LAT num2str(abs(y),'%02i') LON num2str(abs(x),'%03i') '.hgt']

20 Sep 2007 Gabriel Bruno da Mota costa

Usefull. Congratulations. It help-me to understand how to extract .hgt files from SRTM.
Thanks.

15 Jul 2010 Thibaut Leroy

Very good !

Some comments:
The new "FTP" (HTTP :() server is: http://dds.cr.usgs.gov/srtm/

"return" are not necessary after error()

Arround 58 line, you can pre-allocate the "out" list:
out = cell(size(p1,1),1);
(I hope do not have done a mistake..)

22 Jul 2010 Thibaut Leroy

SRTM data are Signed Integer 16 !
You must replace "uint16" by "int16"
(there are town under the sea level !)

Doesn't work with big coast datas (no SRTM file = error). You should add a zeros(1201, 1201) if the file does not exist
It reads too much files in fact, not the only necessary ones..

02 Nov 2010 Michael Melzer  
13 Jan 2011 Renato Iida

I find a error in line 93, you should change to
elseif x>=10 & x<100; LON = 'E0';
without the equal or higher the E010 is create E10 and dont find the file.

Please login to add a comment or rating.
Updates
02 Aug 2004

Fixed bugs ...
... with integer lat/lon mentioned by Boerner.
... with SRTM file in western / southern hemisphere.

03 Dec 2004

V1.00 Fixed bug for abs(lat/lon)<10° mentioned by Tanner. Not tested because I can't log on to the new ftp-address for SRTM-data ...
... let me know if it works.

Tag Activity for this File
Tag Applied By Date/Time
data import Sebastian Hölz 22 Oct 2008 07:28:08
data export Sebastian Hölz 22 Oct 2008 07:28:08
srtm Sebastian Hölz 22 Oct 2008 07:28:08
zprofile Sebastian Hölz 22 Oct 2008 07:28:08
utilities Sebastian Hölz 22 Oct 2008 07:28:08
data Sebastian Hölz 22 Oct 2008 07:28:08
satellite Sebastian Hölz 22 Oct 2008 07:28:08
srtm Rafael Salavera 20 Dec 2008 14:36:18

Contact us at files@mathworks.com