Need help reading a IMG data file for elevation data

Soldato
Joined
16 Dec 2005
Posts
4,054
Location
Halifax W'Yorkshire
Hey guys, right im going to tear my hair out tonight if I don't find a way of doing this.


Basically, I need to convert some elevation data from

http://viewer.nationalmap.gov/viewer/

to replicate what im doing incase it might help show you what im trying to do, tick on the left, elevation index>1/9 arc (which is what I NEED no less). then click the arrow in the blue box at top, select a area the top option, then Elevation DEM Products, and the download is IMG file

I need to somehow read or convert the IMG file that the elevation data is packed into, into some sort of either PNG, or just some sort of general high resolution heightmap that is readable by daylon leveller.

(daylon leveller can open pretty much ANYTHING apart from a img file which is annoying as hell tonight anyway)


Thanks for any help guys, been searching for 2 hours and no closer to reading this damn img file.

Cheers!
 
Also I'll PayPal a 5er to the first person who can explain how to convert a img to a high quality useable bitmap/png or any other file that daylon leveller can use.

Thanks :)

Also if you want to earn a tenner on top read my other topic in the general thread :)
 
Can you post a link to the file you've got(Dropbox or whatever). Whatever I downloaded isn't recognised by my system and it doesn't appear to have a file extention :confused:.
 
Can you post a link to the file you've got(Dropbox or whatever). Whatever I downloaded isn't recognised by my system and it doesn't appear to have a file extention :confused:.

Sorry

Should have included a link to the file im trying to convert. my bad,

Was just browsing forums on my phone in bed, and saw your reply and its that important it jumped straight out of bed to upload it :D

If you can convert this file + show me how to convert these img files to a usable heightmap image or data etc for daylon leveller, the 5er is yours :)

http://www.filedropper.com/ned19n38x50w077x00vaninenortherncos2011

Thanks :)

Gotta get some sleep now up at 8.30am, but will be back on forums at 11:30am ish :)
 
Im not interested in the money.

I dont have daylon leveller and it doesnt appear to exist on certain sites so I will have to try and convert it blindly.

Assuming it's even possible that is. Seems a weird format.

Edit: Right I've hit a roadblock. It appears you can translate a img to a tiff using GDAL and from there you would create a geotiff.

However all my attempts so far have ended up with a completely black screen with only a small section of white in the lower left. Clearly thats wrong so either its a photoshop processing issue or its not working.

Ill have another go on centos as it seems more powerful than the windows variant.

I guess 1/3 arc second isnt detailed enough? Shame as you can download that straight away lol.
 
Last edited:
Last edited:
Right I think there's an issue with the file you linked to.

This is all that's shown even when using the right program to open it(annoyingly the same as photoshop I whinged about earlier);

Capture.png


However if that is correct(I'm assuming not) here are two versions;

Jpg;

http://s000.tinyupload.com/index.php?file_id=07301821833103673739

or tiff;

http://s000.tinyupload.com/index.php?file_id=96700481183769488376

with tfw;

http://s000.tinyupload.com/index.php?file_id=09344370420937611440

Let me know if this works and if so I'll trust you instructions.

Thanks to Rozzy for mentioning the HFA filetype.
 
Last edited:
If you have access to Matlab, should be able to read in the data (it's just binary, possibly with some headers, but it doesn't matter if no headers, you can reconstruct) and manipulate it to your heart's content. Contour it, save it in another format e.g. ascii 2d matrix.

Octave is an open source variant of Matlab.

I have access to Matlab so I'll have a quick look.
 
I downloaded some files, they had how many rows and cols are in the dataset, your cell size (dx) as well. You could easily turn this into a 2d array based upon that.

ncols 3612
nrows 3612
xllcorner -82.00166666667
yllcorner 25.99833333333
cellsize 0.000277777777778
NODATA_value -9999
byteorder LSBFIRST
 
You could probably just use imread('fileName') in MATLAB to read the file into a matrix and then imtool (think it's called that, might be a different function though) to view the image based on this matrix, from there you can save it as whatever format you like really.
 
Imread won't work. It's binary data, so needs lower level such as fread.

Example below. Although this doesn't take into account the structure (such information is contained within other files, e.g. the rows and cols - the metadata), so you get just one long vector.

>> f=fopen('imgn41w077_1.img');
>> a=fread(f);

Saying that, an associated jpg did come with the download. You can read this into Matlab, and based off the colour, get your min and max values of heights through scaling.

untitled.jpg


ugly colourmap but I left it on default :P.
 
Last edited:
Right I think there's an issue with the file you linked to.

This is all that's shown even when using the right program to open it(annoyingly the same as photoshop I whinged about earlier);

Capture.png


However if that is correct(I'm assuming not) here are two versions;

Jpg;

http://s000.tinyupload.com/index.php?file_id=07301821833103673739

or tiff;

http://s000.tinyupload.com/index.php?file_id=96700481183769488376

with tfw;

http://s000.tinyupload.com/index.php?file_id=09344370420937611440

Let me know if this works and if so I'll trust you instructions.

Thanks to Rozzy for mentioning the HFA filetype.

Yes! that's what im looking for, a heightmap like that, I must have fudged up the img file tho because well, haha no idea what that small part is of the area I was trying to do.

how did you do it? :)

Thanks!
 
Arrgh good idea. When and where can I play it? :D.

I expect to be in the credits :D.

"Mynight- random Google hero"
 
Last edited:
Arrgh good idea. When and where can I play it? :D.

I expect to be in the credits :D.

"Mynight- random Google hero"

Haha, well the game is mx vs atv reflex, going to use the data to create a realistic replica of some motocross tracks.

But meh, so far its not working unfortunately the data from that program isn't high quality enough.


If you want another google project you could try find these for me

http://forums.overclockers.co.uk/showthread.php?t=18663718

I know it exists because someone has them but they wont share them with me haha but they managed to find them on the web, I cant find it tho for the life in me.

lookin for heightmaps of glen Helen raceway CA, he got the heightmaps from earthquake scans etc of the fault line close by, and was just lucky that the track was scanned when they scanned the fault line

:)
 
Back
Top Bottom