This is the polar plot established by my own personal virtual radar station, powered by a cheal RTLSDR dongle and the RTL1090 software.
This is the polar plot established by my own personal virtual radar station, powered by a cheal RTLSDR dongle and the RTL1090 software.

The polar plot above was made using the SBS Plotter software (top-left inset). The data was then massaged into a format that could be imported into Google Earth. The rest is some Photoshop magic. Here’s how I made the image above…

Gather Data

I use the SBS Plotter software to create the polar plot. This small application can save the plot for various altitudes and for your maximum range into a file format that is compatible with BaseStation outline files. From within SBS Plotter I selected File > Save “OUT” file. This will save the file in c:\Kinetic\BaseStation\Outlines (or wherever you have BaseStation installed).

If you open that file in a text editor, you’ll see a list of latitude and longitude co-ordinates, something like this:

{ trk=000 - d= 34.1}
44.427+-79.426
{ trk=001 - d= 42.6}
44.567+-79.407
{ trk=002 - d= 34.8}
44.438+-79.398
{ trk=003 - d= 35.3}
44.445+-79.384
{ trk=004 - d= 35.4}
44.447+-79.378

If you scroll down through the thousands of lines, you’ll see that there are actually several lists, one for each altitude range. For our purposes, we need the last list, which begins with:

{ Layer 29 = all data }
$TYPE=29

You’ll want to select and copy all of the text from the start of the list right to the end of the file, which should end with:

{ =============================}

Massage the Data

Massaging the data really means getting rid of the lines we don’t need and reformatting the lines we do need. I used an application called TextWrangler on my Mac, but for you Windows folks there’s an equally capable and free app called Notepad++ that you can use. What you need to do is delete every line that contains curly brackets

{}

In TextWrangler, choose Text > Process Lines Containing…. Enter { in the text field and check on the option to Delete Matched Lines. Click Process. In Notepad++, choose Search > Find, then go to the Mark tab. Enter { in the Find What field and make sure the option to Bookmark Line is on. Click Mark All and then choose Search > Bookmark > Remove Bookmarked Lines.

Also delete the line that says

$TYPE=29

This should leave you with just a list of co-ordinates like this:

44.427+-79.426
44.567+-79.407
44.438+-79.398
44.445+-79.384
44.447+-79.378
44.326+-79.368
44.371+-79.359

I’m in the Western Hemisphere, north of the equator, so my longitudes are negative and my latitudes are positive. Your numbers may be different depending on where you are in the world, so how you complete the next step may be a bit tricky. You’re going to do a find and replace so you can insert a comma between the latitudes and longitudes.

In either TextWrangler or Notepad++, choose Search > Replace. For the Find field, enter

+-

For the Replace field, enter

,-

Then click Replace All. That takes care of the longitudes. Now we need to add the + back to the beginning of the latitudes.

In TextWrangler, choose Text > Prefix/Suffix Lines…. Click Insert, then enter + in the Prefix field. Click OK. In Notepad++, choose Search > Replace again, and change the Search Mode in the bottom left to Extended. Then in the Find field enter

\n4

and in the Replace field enter

\n+4

Of course the number you use may be different depending on what your latitudes are — and the + may need to be a – — but basically you’re telling Notepad++ to replace a “new line followed by a number” with a “new line followed by a plus followed by a number.” Click Replace All. Now fix the first line of the text file by manually prefixing it with either + or – (the find and replace in Notepad++ didn’t do it because the first line isn’t preceded by a new line command). Also delete the last line that reads simply -1.

The last step in massaging our data involves adding a line at the beginning of the file:

lat,long

Now do a Save As and name the file with the extension .csv. We’ve just made a comma-delimited text file that we can use to convert for use in Google Earth.

Convert to KML Format

There’s a very cool website for manipulating GPS data. It’s called GPS Visualizer, and among it’s utilities is a way to convert GPS data for use in Google Earth. The page looks a bit intimidating at first but it’s actually very easy to use.

GPS Visualizer to Google Earth

 

You need to set some fields to make this work:

  • Google Earth doc name, which will be the name of the file created. Enter any name you want.
  • Colorize by, which you should set to “none”
  • Default color, which I set to Cyan because it’s an easy colour to isolate in Photoshop.

The formula for the herbal mix is customized viagra online without for all patients to cure the problems that stem from low libido which can make them feel completely unattractive, undesirable, or like they are just blaming their partner for various issues. The herbs used in the oil are capable of dealing with viagra online online all kinds of problems involving sex with men. The patient’s attitude and following usa cheap viagra of the guidance that has been provided by them by the brand names like Kamagra, Silagra, Zenegra, Forzest, Kamagra oral jelly, Silagra, and Forzest etc. Take up Regular Exercises Having exercises such as running, swimming, jogging, kegels and yoga can help you sooth the nervous system, which in turn helps to uk tadalafil overcome stress and tensions and thus the problem of anxiety would be solved.
Then you can either click Choose File and select the csv file we created above, or copy the data from your file and paste it into the form, as I did in the screenshot above. Once you’re ready, click Create KML file. The result is a link to a kml or kmz file that you can download to your local hard drive and open in Google Earth.

Max Range in Google Earth
Max Range in Google Earth

The Range Rings

You can plot range rings in the same way by creating a similar comma-delimited text file. You need to add two columns, though: one for name, because each range ring has to have a different name, and another column for radius, which will define the size of the range ring. The latitude and longitude for each ring will be the center of it, which are the GPS co-ordinates for your virtual radar station. My range ring csv file looks like this:

name,lat,long,circle_radius
50nm,43.8,-79.4,50 nm
100nm,43.8,-79.4,100 nm
150nm,43.8,-79.4,150 nm
200nm,43.8,-79.4,200 nm
250nm,43.8,-79.4,250 nm

The nm in the circle_radius refers to nautical miles. If we simply put “miles” it would default to statute miles. Convert this data to kml or kmz format using the same web form as above, download the resulting file and open in Google Earth.

EDIT: Image at top was revised with range rings at 50 nautical mile intervals. Instructions for mapping the range rings were modified to include nm in the circle_radius.

11 replies on “Superimpose Your Polar Plot in Google Earth”

  1. Thanks for posting these steps for massaging a .out file into KML. After looking the article over I decided it was worth 45 minutes to automate this via a quick-and-dirty Perl script. This is the script (assuming various embedded KML tags are not filtered by web site):


    # /usr/bin/perl -Tw
    #
    # ConvertPlotFile.pl

    # First argument is the .out file to parse.
    # Second argument is the output file name to store in the KML file.

    my $file = shift @ARGV;
    $file = "sbsplotter.out" if ($file eq "");
    my $outfile = shift @ARGV;
    $outfile = "maxrange" if ($outfile eq "");

    # Search the .out file for the "TYPE=29" records. These
    # are the maximum range records.

    open(OUT, $file) || die $!;
    while ()
    {
    last if ($_ =~ /TYPE=29/);
    }

    if (eof(OUT))
    {
    close(OUT);
    print "Error: no suitable records found\n";
    return;
    }

    # Grab the latitude and longitude records, reversing their order for KML use.

    my @plotdata = "";
    while ()
    {
    next if (/\{.*\}.*/);
    next if (/^-1$/);
    s/\+/,/g;
    my ($lat, $lon) = $_ =~ /([0-9\-\.]+),([0-9\-\.]+)/;
    push @plotdata, $lon . "," . $lat;
    }

    close(OUT);

    # Now generate the KML file. The results are sent to stdout. Simply redirect the output
    # to a file if desired.

    print <<EOF;

    1
    0

    Tracks
    1
    0

    FF0000E6
    4

    1
    clampToGround

    EOF

    my $data;
    foreach $data (@plotdata)
    {
    print $data, " ";
    }

    print "\n";

    print <<EOF;

    EOF

      1. Nicely done! I’m not a PERL guy so I’ll just assume this works. I could do the same thing in Applescript if I had ten minutes to spare 😉

        1. I am looking at the ring code now to see if I can add the KML for creating the rings to the plot creation code. Most of the work is really creating the KML which is relatively static so it will just be a matter of merging the two together and adding variables for the base station latitude and longitude coordinates.

          I have a Mac Retina but I am not familiar with AppleScript. I am sure it would be possible to do it in that language to. Just a lot of string processing. Perl has been my “go to” language for 20 years now when I need to hack something.

        2. Of course what starts out as a simple project winds up morphing into something more. Having gotten the plot to work I decided liked your top photo showing distance rings. So back to the drawing board to add code to generate rings in KML (to which I discovered my trig is a bit rusty but thankfully there are great free math library packages out there as well as code samples for Great Circle calculations).

          So after a bit more hacking I have a script that can take an SBSPlotter .out file and generate a KML file complete with labeled distance rings (as long as an optional origin latitude and longitude are supplied – no origin then just the receiver plot is generated). If you want to test it out PM me and I’ll send you the Perl script. I have a generated KML file of my receiver’s reception over the last several hours at http://www.n2jtx.com/T-KISP3.kml.

  2. Hi Aardvark

    Just come across this article, very interesting. Is there any chance you can share the finished perl code with us? I would like to have an automatically updated image for my website which runs VRS (Virtual Radar Server) and believe that I could automate the production and upload with your script.

    Best wishes

    Jon

    1. If you get it working, I would love to see the result. My email address is in the source code.

  3. Thanks for the Notepad++ instructions.
    Following them got everything up and running very smoothly.
    I found the Google Earth overlay a lot more helpful in understanding my coverage than just the outlines in Basestation. (I wish we could have Google Map, or OpenMap in Basestation – that would be very powerful).

    Looking forward now to tweaking the antenna side of things and clearly seeing the improvements.

  4. I have tried gpx2kml.com to convert GPS data into kml files and it might be a good alternative for you, as well. You can upload files and see the results, no installation required.

Comments are closed.