Support > Environment models

.f32 heightmap creation


Does anyone know of an easy way to create an f32 heightmap from .asc file format strm data ?

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: ---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');

--- End code ---

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

Yes, that's correct.

In fedora 36, the current version i am using then installing the image package on octave does not seen to work using the pkg command withing octave's own "commanline"

I've tried this however from the linux commandline

sudo dnf makecache
sudo dnf install octave-image.x86_64


[0] Message Index

Go to full version