Please login or register.

Login with username, password and session length

News:

Registration is only required if you want to post, and is not needed to read any posts. To avoid excess 'spam' accounts, all accounts where no posts have been made will be deleted after two weeks. Please register again if you wish to post.

Author Topic: .f32 heightmap creation  (Read 16401 times)

June 25, 2017, 09:38:44 PM
  • Member
  • **
  • Posts: 41
  • Officer of the Watch Deck
    • View Profile
Does anyone know of an easy way to create an f32 heightmap from .asc file format strm data ?

July 14, 2017, 08:36:09 PM
Reply #1
  • Administrator
  • Member
  • *****
  • Posts: 125
    • View Profile
Hi, do you have access to Matlab, or Octave (an open source alternative)? If so, it's quite easy to process the height data into a binary f32 file.

I used a simple script to process .asc NOAA Coastal Relief model data to .f32:

This example takes an ascii text file (in.txt) for the area of interest, with all header information removed, and scales it to 2049x2049, then saves it. You will need to think about how to handle the elevations for the sea area. This example sets everything at 0m or less to -10m.

Code: [Select]
clear
pkg load image
load 'in.txt';
in = flipud(in); %Flip in north-south direction
scaled = imresize(in,[2049 2049]);

%Do any extra processing here
scaled(scaled<=0) = -10; %This would set any elevations at or below 0 in the raw data to -10m

fileID = fopen('height2049.f32','w');
fwrite(fileID,scaled,'single');
fclose(fileID);

November 05, 2017, 02:42:53 PM
Reply #2
  • Member
  • **
  • Posts: 41
  • Officer of the Watch Deck
    • View Profile
when you mean strip the headers do you mean, manually delete this (in the case of an srtm .asc file) ....

ncols         6001
nrows         6001
xllcorner     -0.00041661826815287
yllcorner     49.999583817591
cellsize      0.00083333333333333
NODATA_value  -9999



November 14, 2017, 07:42:25 AM
Reply #3
  • Administrator
  • Member
  • *****
  • Posts: 125
    • View Profile
Yes, that's correct.