Quick Amateur Radio Prefix Lookup Software
**** PfxLookup.exe ****
….. FREEWARE ….
Illustrated: V1.0.0.3
21st April 2018
Have you ever just wanted to do a quick country lookup when you hear an unusual prefix on the amateur bands ? Where should you point your antenna ?? Can’t find it quickly via Google or don’t have internet access ?
I have been finding that I am seeing new prefixes on FT8 when tuned to various bands and, because I haven’t been overly active on-air for a while, I simply don’t recognise the amateur prefix. I usually try to do a Google search but sometimes it doesn’t produce worthwhile results in that it doesn’t really tell me where it is, or even has a country name that has changed since I last heard of it.
Of course, like many of the logging packages, the WSJT-X software does have some callsign lookup info and it will show a bearing BUT only once you have selected a callsign by double-clicking on it to start a QSO, and then sometimes it doesn’t find a matching country or bearing. Many of these applications use a country database maintained by Jim Reisert AD1C and thus contain the same data but in some different file formats. WSJT-X requires the CTY.DAT file available to have updated prefix lookup so is readily available. (from http://www.country-files.com/cty/cty.dat and placed in the same folder as the WSJT-X log support files)
If you are like me, I don’t running logging software as a matter of course so the country lookup and bearing info is not available immediately. It was because of this that I started a new software project to do a quick prefix lookup and provide country name and bearing information while based on that CTY.DAT data file. The format of that file is provided but not how to utilise it – that seems to be proprietary to the various logging software designers (and now me too). It has taken a bit of trial and error to get the country lookup functioning simply because there are so many prefix variations in some countries.
The core of the code will be integrated into a near-future version of my WSJTX Log Viewer software to provide the same basic country and bearing information once a callsign is entered in its Search box. This application started as a test bed for the code for the Viewer but then was completed as a stand-alone product.
My country details lookup software, PfxLookup.exe for Windows 7+, loads the currently-available-in-the-folder CTY.DAT file each time the application is started up. Make sure you update that file only while the application is NOT running, not that it will be used until next time anyway.
Application screen on startup the first time. The number at bottom left is generated as the CTY.DAT file loads on program startup.
The desired callsign data is entered in the input box near the CALLSIGN tag, the 'Lookup' button is pressed or the Enter key is pressed and the country name plus the continental area is displayed eg (AF) for Africa.
With my grid locator in place and after the 'Go button' is pressed.
More information is available if the user’s maidenhead grid square detail is entered. My home QTH grid is QG62LG and entering this in the My Grid box and use of the Enter key (or by pressing the Go button) converts this to local latitude and longtitude (note the grid value is saved for ‘next’ time). Pressing the Lookup button now adds the approximate bearing and distance information to the display.
The position on screen is retained from one application run to the next.
The completed lookup.
Yellow boxes are user input boxes, the white and aqua are for outcomes...
To keep the CTY.DAT file up to date, clicking on the URL shown near bottom centre ( http://www.country-files.com/cty/cty.dat ) actually loads that URL into the Windows clipboard - although nothing obvious has occurred. Open a browser window, paste the clipboard by CTRL-V and the currently-available-from-the-web file should download. Close the PfxLookup application then copy the CTY.DAT file into the same folder and re-start PfxLookup to utilise the new data file. The number of CTY record details created is shown on screen and will vary from one version of the file to the next.
----------------------------------------
Will it ALWAYS provide the correct country results ??? In short, NO.
The algorithm used to parse the prefix list can have false matches.
It does not differentiate well with different call areas under a starting prefix as far as distance and bearing is concerned. For example, any general W-land callsign will produce the same value of latitude and longtitude regardless if it is a W0, W8, K4 or N9. From VK4, it is about 60 degrees +/- 15 anyway and the calculation process here shows 59 degrees. The details in CTY.DAT are the limiting factor.
Use on a continent with large prefix/call areas will often produce invalid (but generalised) results. The physically closer and larger the prefix area, the greater the bearing error is likely to be.
Otherwise, the callsigns most likely to have lookup errors are the special event callsigns which sometimes have very unusual construction, weird prefixes and the like. Easily fix-able - no...
My testing shows that it will produce reliable results except when the country prefix data is very complex. For example, the entry for Canada in my current CTY.DAT looks like:
Canada: 05: 09: NA: 44.35: 78.75: 5.0: VE:
CF,CG,CJ,CK,VA,VB,VC,VE,VG,VX,VY9,XL,XM,CF2[4],CG2[4],CH1,CH2(2), CI0(2)[4],CI1(1)[2],CI2,CJ2[4],CK2[4],CY1,CY2(2),CZ0(2)[4],CZ1(1)[2],CZ2, VA2[4],VB2[4],VC2[4],VD1,VD2(2),VE2[4],VF0(2)[4],VF1(1)[2],VF2,VG2[4],VO1, VO2(2),VX2[4],VY0(2)[4],VY1(1)[2],VY2,XJ1,XJ2(2),XK0(2)[4],XK1(1)[2],XK2, XL2[4],XM2[4],XN1,XN2(2),XO0(2)[4],XO1(1)[2],XO2,=VER20180322, =VA2RC(2)[4],=VA2VVV(2)[4],=VE2CSI(2)[4],=VE2EKA(2)[4],=VE2FK[9], =VE2IDX(2)[4],=VE2IM(2)[4],=VY0PW(4)[3];
The Russian, Japanese and Chinese prefix entries are even more complex so the results might be even more variable.
It does the country lookup correctly MOST of the time so is still a useful FREE software tool.
----------------------------------------
The ZIP of the Prefix Lookup application may be downloaded from HERE. Currently V1.0.0.6
(ZIP size around 240KB, giving an EXE around 400KB plus a CTY.DAT around 80KB)
(Please do not copy this file and make available from other websites - the latest version will only be available via this link,)
Installation is simple. Just extract the file PfxLookup.zip it into any folder (preferably a new/empty one), make a Desktop shortcut to it by right-clicking then select ‘Send to’ and then “Desktop’. . It has a copy of CTY.DAT included in the ZIP file so nothing else is required immediately to make it function. It is probably still a good idea to update CTY.DAT to get the best lookup accuracy.
To remove the application, delete the folder containing the executable and CTY.DAT.
By all means virus scan it before you execute it !
Please note that it is early in development so may have some issues to be resolved as yet.
Notify of any bugs found direct to 'doug at vk4adc dot com' with subject 'PfxLookup Bug'.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Releases:
V1.0.0.1 21April2018 Initial release.
V1.0.0.2 22April2018 Some box colours updated and made read-only. The callsign lookup and locator detail conversion now activates on use of the Enter key. The results are now shown as 'Callsign : Country (Continent)' so the callsign box can be cleared automatically after lookup. Hints for boxes and controls activated.
V1.0.0.3 22April2018 Updated search callsign handling when a slash is present eg VK4ADC/6, VK6/VK4ADC, VK4ADC/VK6 so that the effective callsign is dynamically changed to reflect the locational information. Search suffixes like /QRP are now ignored. Some errors still encountered when a permanent callsign allocation exists in CTY.DAT eg VK4ADC/W6 appears as Hawaii because the first entry matching W6 is W6CWJ,Hawaii,OC {21.12^157.48}. Changing it to /W5 is ok because the first entry against W5 is in the USA. Can't fix this one.
Version detail added in header to make it easy to verify version in use.
V1.0.0.4 23Apr2018 Bug fix for /MM callsigns.
V1.0.0.5 26Apr2018 Changed lookup routines so that the same code sections are used in both PfxLookup and WSJTX LogView ensuring identical results.
V1.0.0.6 16Oct19 Fixed decimal separator code causing a floating point error when a comma is the separator char in some European countries.