Compile and setup RF coverage prediction software SPLAT!

 Posted by:   Posted on:   Updated on:  2020-06-22T18:35:57Z

How to compile SPLAT! on Windows and Linux. Where to get digital elevation models (SRTM) and how to convert them to SPLAT! format.

SPLAT! is a cross-platform, open-source software that can be used to analyze a radio link between two locations and to generate coverage maps of RF transmitters. Coverage maps are calculated using Longley-Rice Irregular Terrain Model (ITM) algorithm. SPLAT! can predict RF coverage for any frequencies between 20 MHz and 20 GHz. It is thus useful for ham radio, broadcast radio, terrestrial television and wireless networks.

SPLAT! uses data from SRTM elevation files. Although it is cross-platform, up-to-date binaries for Windows are hard to find. On the other hand, for Linux users, it is available in the repositories of the major distributions. This post will show you how to compile SPLAT! on Windows and Linux, how to obtain and convert elevation data and at last how to generate point-to-point and coverage prediction analysis.

There are two variants of SPLAT! based on the type of elevation data they use. SRTM3 files are 90 meters resolution, 3 arc-sec files. These are the "standard definition" files suitable for SPLAT! And there are SRTM1, 30 meters resolution, 1 arc-sec files that are considered "high definition" and are suitable for SPLAT! HD. I recommend SRTM3 (SD) files because the results are very good and processing time is not too high.

SPLAT! line-of-sight coverage
SPLAT! line-of-sight coverage

Install on Windows

The source code can be downloaded from author's site: John Magliacane, KD2BD. To compile it you need to get MinGW. I recommend the internet installer. SPLAT! needs MSYS environment to compile, so make sure to select mingw32-base mingw32-gcc-g++ msys-base mingw32-bzip2 (both bin and dev for library) packages in MinGW Installation Manager. When the installation is over, and you installed in the default folder, you can go to C:\MinGW\msys\1.0 and you will find there msys.bat. Launch this script that will open the MSYS console. Now, in the same folder with this script, there is a new subfolder home that contains another folder named by your username. In this folder (C:\MinGW\msys\1.0\home\<username>) you will place the folder with extracted SPLAT! source code archive (splat-1.4.2 folder should result).

There is a problem with SPLAT! and Windows. It comes with an utility to convert SRTM HGT file to SDF files. This utility uses by default ":" character in file names (example of a filename: 40:41:336:337.sdf). This is incompatible with Windows. We have to modify the source code. I recommend Notepad++ for this operation, but you can use any editor of your choice. You must replace all occurrences of "%d:%d:%d:%d" with something Windows compatible such as "%d_%d_%d_%d". The files of interest are splat.cpp and srtm2sdf.cpp from utils subfolder. Keep in mind that files passed to srtm2sdf must have the extension hgt (not HGT) - the utility is still case sensitive!

Replace file name pattern in SPLAT source code
Replace file name pattern in SPLAT source code
There's one last change you must make. If the elevation data files are not opened in binary mode, the conversion will stop at first occurrence of 0x1A byte which is considered EOF. Find in srtm2sdf.c a line that looks like (it is line 160 in version 1.4.2):
infile=open(filename, O_RDONLY);
and replace it with something like:
infile=open(filename, O_RDONLY | O_BINARY);
Save files. Return to the MSYS console and type these commands:
cd splat-1.4.2
configure
You will be asked to select the maximum analysis region. The bigger the better, as long as you have enough RAM. You will have to provide this option twice, for SPLAT! and SPLAT! HD.

SPLAT compilation in MSYS console
SPLAT! compilation on Windows
Don't use the install command as suggested. Instead, you will find the SPLAT! executable in the same folder as the source code. You need that and the srtm2sdf utility that got compiled in utils folder. Take them and put them in a folder of your choice. I recommend C:\SPLAT. If you compiled SPLAT HD! take that too and its corresponding srtm2sdf-hd utility.

Install on Linux

Things are much easier in this situation. You will find SPLAT! in the repositories and you can install in Linux Ubuntu:
sudo apt install splat
The compilation from source does not need source code editing. Just download the source archive, extract it, open a terminal in that folder and run the commands:
sudo apt install build-essential libbz2-dev
./configure
sudo ./install all
You will be prompted to select the maximum analysis region. That's it. You should now be able to run splat and its utilities from terminal in any folder.

Elevation data

There are multiple sources you can get SRTM data from. It's easy to get data prepared by Jonathan de Ferranti on viewfinderpanoramas.org. Click the regions you want and an archive will be downloaded with SRTM3 files for those regions. Extract these archives on a folder of your choice. It can be on another partition if you want, but it is recommended not to use spaces in the path.

I made this folder structure (on Windows):
C:\SPLAT
 - splat.exe
D:\SPLAT_data
 - sdf
 - srtm3
In srtm3 folder I placed all HGT files downloaded earlier. In sdf folder will be created SPLAT elevation files after running srtm2sdf on hgt files. Unfortunately, this utility takes on file at a time so we need a batch script. If you're using the SRTM1 files (HD) you need to run the utility srtm2sdf-hd. If you don't know how do differentiate SRTM1 from SRTM3, file size is the most important criteria. SRTM3 are exactly 2884802 bytes in size while SRTM1 have 25934402 bytes. Any file of a different size is not a valid SRTM file!

This is for Windows users:
for /f %%f in ('dir /b D:\SPLAT_data\srtm3') do C:/SPLAT/srtm2sdf "D:/SPLAT_data/srtm3/%%f"
Change folder paths as needed. Place this into a text file and save it as script.bat in sdf folder (D:\SPLAT_data\sdf in my case). Double click on it to start batch processing.

Linux users will make a sdf folder wherever they want and save the following snippet as script.sh in the sdf folder.
#!/bin/bash  
shopt -s nullglob  
for f in /<path_to_srtm_folder>/*.hgt; do  
    echo "Converting $f"  
    srtm2sdf $f 
done  
Adjust the absolute path to SRTM3 files. After path is the "/*.hgt" file filter. Open a terminal in the same directory and run chmod +x ./script.sh && ./script.sh. The conversion will start.

At this point, you should have a working SPLAT! software. You can run splat in terminal or C:\SPLAT\splat.exe in Command Prompt and you should see program's output (usage instructions). Now that you installed SPLAT!, let's see how to use it.

Further reading:
Updated instructions for 64-bit SPLAT! on Windows 10

If you're having troubles compiling from source, here are precompiled binaries for both 32-bit and 64-bit Windows:

12 comments :

  1. I tried running the guide for windows but it doesn't work.

    ReplyDelete
  2. what do you mean with " In sdf folder will be created SPLAT elevation files after running srtm2sdf on hgt files."? I have tried the srtm2sdf utility, but it can't run. Anyone who can help me, please!

    ReplyDelete
  3. Got to the point of running compiler on 1.4.2 but it fails for dependency problems etc.

    Ben

    ReplyDelete
    Replies
    1. Hello Ben! It worked for me when I wrote this post. What dependency errors you get? Note that there are also (older) Windows builds: http://www.ve3ncq.ca/wordpress/?page_id=62.

      Delete
  4. could you make the compiled files of splat 1.4.2 for windows available?

    ReplyDelete
  5. The error you give during compilation is:

    Compiling SPLAT!... splat.cpp:28:19: fatal error: bzlib.h: No such file or directory
    #include
    ^
    compilation terminated.
    Compilation failed!
    Compiling SPLAT! HD... splat.cpp:28:19: fatal error: bzlib.h: No such file or directory
    #include
    ^
    compilation terminated.
    Compilation failed!
    Compiling citydecoder... ./build: line 10: cc: command not found
    Compilation failed!
    Compiling usgs2sdf... ./build: line 22: cc: command not found
    Compilation failed!
    Compiling srtm2sdf... ./build: line 34: cc: command not found
    ln: creating symbolic link `srtm2sdf-hd' to `srtm2sdf': No such file or directory
    Compilation failed!
    Compiling fontdata... ./build: line 49: cc: command not found
    Compilation failed!
    Compiling bearing... ./build: line 62: cc: command not found
    Compilation failed!

    ReplyDelete
    Replies
    1. You must install mingw32-bzip2 package from MinGW installation manager.

      Delete
  6. The calculation is much slower than in linux

    ReplyDelete
  7. hi,
    im getting linking errors when trying to run the apllication in windows. When i run it under the msys shell splat runs without issue.

    cheers

    ReplyDelete
  8. apparently everyone associated with splat is unable to actually make it work.

    links to hgt files -> dead

    instructions -> dont work

    output -> worthless

    ReplyDelete
    Replies
    1. Things have changed since this was posted. Now, you need an account to download SRTM files which can be found in the Data Sets section of https://earthexplorer.usgs.gov/.

      Delete

Please read the comments policy before publishing your comment.