SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > SH5 Mods Workshop
Forget password? Reset here

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 02-05-19, 12:33 PM   #11
OldCoder
Sparky
 
Join Date: Mar 2016
Posts: 150
Downloads: 25
Uploads: 0
Default

That 30m data and the hgt reader at github was a good find.

I've cooked up a little c++ exe that will read the hgt and dump the contents into output files. One output file is text format, and looks like:

51.999722 1.000000 47
51.999722 1.000833 47
51.999722 1.001666 46

where that's LAT/LON and height in metres.

Second format is a greyscale image in PGM format, documented here: https://en.wikipedia.org/wiki/Netpbm_format.

The image created looks exactly like the preview button image at the earthdata site, so I know it's correct (at least for the single tile I tested).

So, download the height.zip file and put it into an empty folder.
Then download a srtm hgt tile file and drop it into an srtm subfolder.

Then run it like:

height.exe 51 1 3 200


51 1 are the LAT/LON from the tile filename.
3rd param is the stepping value. Specifying 3 results in a 1201x1201 image file. Specifying 1 is the highest resolution of 30m 1 arc-second data, and generates output at 3601x3601.
The 4th param is calibration of black to white, mapped to max height. So if you specify 200, then 0 is black and anything at 200+m will be drawn (and clipped if necessary) in white. You could specify 1000 instead and then a lot of low lying ground will be black or very dark, and only the highest mountains would be white.

The text file output scales similarly in size according to the 3rd param.


Also, you can run the exe with only 2 params just to return height at a specific LAT/LON if you want:

height.exe 51.389057 1.384060 and it will return interpolated height of 9.3m


I've only tested it briefly, so it may be a bit buggy lol.


Unfortunately the forum won't let me upload the exe zip to this message, but when I find out a way to upload it I will do so.
OldCoder is offline   Reply With Quote
 

Tags
enviromental mod, environment, terrain, trees, vegetation

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 01:10 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Copyright © 1995- 2026 Subsim®
"Subsim" is a registered trademark, all rights reserved.