New Members

New Members

You should get an activation email when you join.  If not, please contact

info@radarspotting.com
Welcome, Guest. Please login or register.
August 25, 2019, 03:25:41 am

Login with username, password and session length

Members
Users Online
Users: 1
Guests: 63
Total: 64

Silhouettes, Profiles and Operator Logos

If you're looking for a bulk download, we have nearly 47,000 aircraft silhouettes, profiles and operator logos available in bmp file format, 85x20 pixels. You can find all the Zip files here.  

And you can request new logos or silhouettes in the the Logo section - Ian K, Paulm, Steve Hibberd, Mustang51, Chris Alder, s92driver and Simon Brooke.  Latest Additions






Author Topic: Countries.dat file for Basestation  (Read 5193 times)

0 Members and 1 Guest are viewing this topic.

Offline Roadrunner

  • Member
  • ****
  • Posts: 576
  • Country: gb
    • http://radarspotting.com/forum/index.php?action=treasury
Countries.dat file for Basestation
« on: May 16, 2017, 07:35:35 am »

Hi everyone, I cant find any recent updates to the countries.dat file and I notice that I am getting lots of new "China" allocations not showing a country flag.


Regards Mike



  • SBS3

Offline Anmer

  • Administrator
  • Top Poster
  • *****
  • Posts: 8331
  • Country: wales
    • https://radarspotting.com/forum/index.php?PHPSESSID=95c2b5dc4a252368646776551e1f51d1&action=treasury
Re: Countries.dat file for Basestation
« Reply #1 on: May 16, 2017, 08:01:54 am »
Bones and SabreJV used to "maintain" the countries.dat file but I haven't seen a new version for some time.

If one knows the ICAO hex code range that's been allocated, it's not too difficult to update the file.  But it needs a carefully planned conversion and I'd have to dig deep to find the "code".
  • SBS-1, SBS-1eR, SBS-3 and RadarBox
Here to Help.

Offline Roadrunner

  • Member
  • ****
  • Posts: 576
  • Country: gb
    • http://radarspotting.com/forum/index.php?action=treasury
Re: Countries.dat file for Basestation
« Reply #2 on: May 16, 2017, 08:19:50 am »
That was one of the areas that the Radarbox was easier - used the actual codes not hexadecimal versions as does BaseStation!
  • SBS3

Offline jakems

  • Member
  • ***
  • Posts: 56
  • Country: england
Re: Countries.dat file for Basestation
« Reply #3 on: May 16, 2017, 09:06:32 am »
Hi

On the whole the countries.dat needs very little maintenance, we don't get that many new countries every year! The changes tend to be where new sub-ranges are allocated by a country to its military or dependant territories. When you say that China is not showing a flag do you mean mainland China? The current countries.dat has 780000 to 7BFFFF for mainland China civil. China was using 780xxx and is now using 781xxx so they should be covered. Where is the flag not showing, Basestation or one of the addons? If you have some specific examples I can take a look for you.

China=011110xxxxxxxxxxxxxxxxxx,6,China.bmp
  • Puck 1090
Steve

Offline Triple7

  • Member
  • ****
  • Posts: 903
  • Country: england
    • http://radarspotting.com/forum/index.php?action=treasury
Re: Countries.dat file for Basestation
« Reply #4 on: May 16, 2017, 09:50:21 am »
Just for interest, what does to No. at the end indicate?

China=011110xxxxxxxxxxxxxxxxxx,6,China.bmp

Tim
  • SBS-1er, RPi2 + FA Pro Stick & 1090 filter

Offline jakems

  • Member
  • ***
  • Posts: 56
  • Country: england
Re: Countries.dat file for Basestation
« Reply #5 on: May 16, 2017, 09:55:50 am »
The 6 means that the 6 most significant bits are used. So in this case it shows 1 & 0 in the first 6 positions and then the remaining 18 positions can be any value. I believe the last 18 can be any characters, BS looks at the 6 and say only look at the first 6.
  • Puck 1090
Steve

Offline Anmer

  • Administrator
  • Top Poster
  • *****
  • Posts: 8331
  • Country: wales
    • https://radarspotting.com/forum/index.php?PHPSESSID=95c2b5dc4a252368646776551e1f51d1&action=treasury
Re: Countries.dat file for Basestation
« Reply #6 on: May 16, 2017, 10:37:15 am »
Thanks Steve (jakems).

I did my digging and found my reference model.  Thanks to Jack Ford and Dave Reid for the original data.

All you need to do when converting a code or range to binary is to make sure that the total number of ones and zeroes corresponds to the number that you have told BaseStation to expect, and if necessary add leading zeroes.

For example, American Airlines B772, N781AN.

The ICAO hex code:

AA944A.

The binary equivalent:

1010 1010 1001 0100 0100 1010

Using the conversion chart shown as an attachment.

A A 9 4 4 A

The BaseStation Countries.dat file for the US civil shows:

United States=1010xxxxxxxxxxxx,4,UnitedStates.bmp

This is telling BaseStation to translate any ICAO hex codes beginning with 1010 (A) as US civil and apply the corresponding UnitedStates.bmp flag in the BMPFlags folder.  As Steve has explained, the "4" is telling BaseStation to match only on the first 4 characters.

For the United Kingdom, the Countries.dat shows:

United Kingdom=010000xxxxxxxxxx,6,UnitedKingdom.bmp

In this case BaseStation is told to apply the UK flag to any of the first 6 codes beginning:

4 (0100)

and any character that starts with two zeros.  So we could have

40 (0000)
41 (0001)
42 (0010)
43 (0011)

As they say, "Simples".  ;)


« Last Edit: June 13, 2018, 03:02:34 pm by Anmer »
  • SBS-1, SBS-1eR, SBS-3 and RadarBox
Here to Help.

Offline Triple7

  • Member
  • ****
  • Posts: 903
  • Country: england
    • http://radarspotting.com/forum/index.php?action=treasury
Re: Countries.dat file for Basestation
« Reply #7 on: May 16, 2017, 11:27:41 am »
Thanks for those explanations - that makes it clearer. I use the windows scientific calculator to convert between hex and binary (if I really need to!)

Tim
  • SBS-1er, RPi2 + FA Pro Stick & 1090 filter

Offline jakems

  • Member
  • ***
  • Posts: 56
  • Country: england
Re: Countries.dat file for Basestation
« Reply #8 on: May 16, 2017, 12:38:44 pm »
Good explanation Anmer. The only thing to add is that some of the ranges overlap. Take a look at:

United Kingdom=010000xxxxxxxxxxxxxxxxxx,6,United_Kingdom.bmp
United Kingdom Mil=0100001111xxxxxxxxxxxxxx,10,United_Kingdom_Mil.bmp

You see that the first 6 bits are the same, this is the allocation given to the UK, 400000-43FFFF. The CAA have then allocated the block 43C000-43FFFF to the MoD, which has the unique first 10 bits. So if you find that a hex you are trying to decode falls within more than one range it is the range with the largest number at the end you use.

Simples Clear as mud!
  • Puck 1090
Steve

Offline Anmer

  • Administrator
  • Top Poster
  • *****
  • Posts: 8331
  • Country: wales
    • https://radarspotting.com/forum/index.php?PHPSESSID=95c2b5dc4a252368646776551e1f51d1&action=treasury
Re: Countries.dat file for Basestation
« Reply #9 on: May 16, 2017, 01:09:44 pm »
Thanks Steve.  Clearly I'm learning as you explain things  ::)

I made this a Sticky topic.  Too good to lose.  ;)
  • SBS-1, SBS-1eR, SBS-3 and RadarBox
Here to Help.

Offline Roadrunner

  • Member
  • ****
  • Posts: 576
  • Country: gb
    • http://radarspotting.com/forum/index.php?action=treasury
Re: Countries.dat file for Basestation
« Reply #10 on: May 17, 2017, 07:25:22 am »

Hi all, to expand on my request. I use an SBS-3 amd update via the Plane Base updates. My SQB file is in the correct format for their updates. The latest China aircraft to be listed minus a country was new CES B77W B-2020 hex 780D90.


I think the other recent ones have also been CES aircraft but can't be certain as I have been manually entering and I understand ? that they only get looked up on first contact .
The entries I have in my Countries.dat for China ( and there are lots) are as follows.


China=011110xxxxxxxxxxxxxxxxxx,6,China.bmp
China_1=0111100000000001000xxxxx,19,China.bmp
China_2=01111000000010100000000x,23,China.bmp
China Hong Kong_1=0111100000000001xxxxxxxx,16,China_Hong_Kong.bmp
China Hong Kong_2=011110000000001000xxxxxx,18,China_Hong_Kong.bmp
China Hong Kong_3=011110000000101000xxxxxx,18,China_Hong_Kong.bmp
China Hong Kong_4=0111100000001010010xxxxx,18,China_Hong_Kong.bmp
China Hong Kong_B-HRA=011110000000001001000000,24,China_Hong_Kong.bmp
China Hong Kong_B-LHM=011110000000001001000001,24,China_Hong_Kong.bmp
China Hong Kong_B-LSC=011110000000001001000011,24,China_Hong_Kong.bmp
China Hong Kong_B-LSM=011110000000001001000010,24,China_Hong_Kong.bmp
China Macau_1=011110000000001100111xxx,21,China_Macau.bmp
China Macau_2=011110000000001101000xxx,21,China_Macau.bmp
China Macau_B-MAB=011110000000001100110110,24,China_Macau.bmp
China Macau_B-MAC=011110000000001100110111,24,China_Macau.bmp
China Macau_B-MAS=011110000000000100001000,24,China_Macau.bmp
China Macau_B-MAU=011110000000001010111010,24,China_Macau.bmp
China Macau_B-MAV=011110000000001010111100,24,China_Macau.bmp
China Macau_B-MAW=011110000000001011000100,24,China_Macau.bmp
China Macau_B-MAX=011110000000010000011000,24,China_Macau.bmp
China Macau_B-MAY=011110000000010000011001,24,China_Macau.bmp
China Macau_B-MAZ=011110000000010000011010,24,China_Macau.bmp
China Macau_B-MBA=011110000000010000011011,24,China_Macau.bmp
China Macau_B-MBB=011110000000010000011100,24,China_Macau.bmp
China Macau_B-MBD=011110000000000011001011,24,China_Macau.bmp
China Macau_B-MBE=011110000000010000100011,24,China_Macau.bmp
China Macau_B-MBF=011110000000010000100100,24,China_Macau.bmp
China Macau_B-MBG=011110000000010000100101,24,China_Macau.bmp
China Macau_B-MBH=011110000000010000100110,24,China_Macau.bmp
China Macau_B-MBI=011110000000010000100111,24,China_Macau.bmp
China Macau_B-MBJ=011110000000010000110000,24,China_Macau.bmp
China Macau_B-MBK=011110000000010010010100,24,China_Macau.bmp


I have no idea if their is anything wrong with these entries.
  • SBS3

Offline Anmer

  • Administrator
  • Top Poster
  • *****
  • Posts: 8331
  • Country: wales
    • https://radarspotting.com/forum/index.php?PHPSESSID=95c2b5dc4a252368646776551e1f51d1&action=treasury
Re: Countries.dat file for Basestation
« Reply #11 on: May 17, 2017, 07:54:12 am »
Hi Mike

Is the extract what you have added/edited for China?

Do you know the allocated hex range for China?
  • SBS-1, SBS-1eR, SBS-3 and RadarBox
Here to Help.

Offline jakems

  • Member
  • ***
  • Posts: 56
  • Country: england
Re: Countries.dat file for Basestation
« Reply #12 on: May 17, 2017, 08:58:43 am »
Hi

The China entries listed look as if they are the ones from the last countries.dat on Bones web site. I think you will find the hex code for B-2020 is 780D9C. This would only fall within the range of the first entry that covers 780000 to 7BFFFF. If BaseStation is running without any addons then I would expect it to display the correct flag. I use Active Display Pro which does not use the Countries.dat to determine the country. Sorry but I am afraid I have no experience of Plane Base so cannot say what it may be doing.

Just for interest this is the hex ranges for China built from my Countries.dat.

Country   RangeStart   RangeEnd
China   780000   7800CA
China Macau   7800CB   7800CB
China   7800CC   780107
China Macau   780108   780108
China   780109   78011F
China Hong Kong   780120   780243
China   780244   7802B9
China Macau   7802BA   7802BA
China   7802BB   7802BB
China Macau   7802BC   7802BC
China   7802BD   7802C3
China Macau   7802C4   7802C4
China   7802C5   780335
China Macau   780336   780336
China   780337   780337
China Macau   780338   780347
China   780348   780417
China Macau   780418   78041C
China   78041D   780422
China Macau   780423   780427
China   780428   78042F
China Macau   780430   780430
China   780431   780493
China Macau   780494   780494
China   780495   780A01
China Hong Kong   780A02   780A9F
China   780AA0   7BFFFF
  • Puck 1090
Steve

Offline s92driver

  • Member
  • ****
  • Posts: 784
  • Country: gb
Re: Countries.dat file for Basestation
« Reply #13 on: May 17, 2017, 11:09:39 am »
Planebase does show the ModeS for B-2020 as 780D9C, so just a typo by Mike (Roadrunner) in his message.

The hex code converts to binary  011110000000110110011100

A quick run through the Countries.dat file for China produces the following matches for logic:


China=011110xxxxxxxxxxxxxxxxxx,6,China.bmp                                            YES
China_1=0111100000000001000xxxxx,19,China.bmp                               NO
China_2=01111000000010100000000x,23,China.bmp                               NO
China Hong Kong_1=0111100000000001xxxxxxxx,16,China_Hong_Kong.bmp      NO
China Hong Kong_2=011110000000001000xxxxxx,18,China_Hong_Kong.bmp      NO
China Hong Kong_3=011110000000101000xxxxxx,18,China_Hong_Kong.bmp      NO
China Hong Kong_4=0111100000001010010xxxxx,18,China_Hong_Kong.bmp      NO
China Hong Kong_B-HRA=011110000000001001000000,24,China_Hong_Kong.bmp       NO
China Hong Kong_B-LHM=011110000000001001000001,24,China_Hong_Kong.bmp   NO
China Hong Kong_B-LSC=011110000000001001000011,24,China_Hong_Kong.bmp   NO
China Hong Kong_B-LSM=011110000000001001000010,24,China_Hong_Kong.bmp   NO
China Macau_1=011110000000001100111xxx,21,China_Macau.bmp                 NO
China Macau_2=011110000000001101000xxx,21,China_Macau.bmp                 NO
China Macau_B-MAB=011110000000001100110110,24,China_Macau.bmp         NO
China Macau_B-MAC=011110000000001100110111,24,China_Macau.bmp         NO
China Macau_B-MAS=011110000000000100001000,24,China_Macau.bmp         NO
China Macau_B-MAU=011110000000001010111010,24,China_Macau.bmp         NO
China Macau_B-MAV=011110000000001010111100,24,China_Macau.bmp         NO
China Macau_B-MAW=011110000000001011000100,24,China_Macau.bmp         NO
China Macau_B-MAX=011110000000010000011000,24,China_Macau.bmp         NO
China Macau_B-MAY=011110000000010000011001,24,China_Macau.bmp         NO
China Macau_B-MAZ=011110000000010000011010,24,China_Macau.bmp         NO
China Macau_B-MBA=011110000000010000011011,24,China_Macau.bmp         NO
China Macau_B-MBB=011110000000010000011100,24,China_Macau.bmp         NO
China Macau_B-MBD=011110000000000011001011,24,China_Macau.bmp         NO
China Macau_B-MBE=011110000000010000100011,24,China_Macau.bmp         NO
China Macau_B-MBF=011110000000010000100100,24,China_Macau.bmp         NO
China Macau_B-MBG=011110000000010000100101,24,China_Macau.bmp         NO
China Macau_B-MBH=011110000000010000100110,24,China_Macau.bmp         NO
China Macau_B-MBI=011110000000010000100111,24,China_Macau.bmp         NO
China Macau_B-MBJ=011110000000010000110000,24,China_Macau.bmp         NO
China Macau_B-MBK=011110000000010010010100,24,China_Macau.bmp         NO


So I would have thought it should display the China.bmp based on the first line?  I've closely checked the formatting of the entry including the correct number of Xs and it all seems OK.

Perhaps a more comprehensive list of mainland Chinese ModeS codes that don't display, along with a list of those that do will help pin this down?



Steve

Offline David Finch

  • New Member
  • *
  • Posts: 19
  • Country: gb
Re: Countries.dat file for Basestation
« Reply #14 on: May 27, 2017, 01:35:45 pm »
Hi

Recently noted that the Kuwait C17's and C130's were showing a civil flag so I added the following to my Countries.dat file.  Don't know if there is a shorter version for these?

Kuwait Mil_KAF326=011100000110000111110101,24,Kuwait_Mil.bmp
Kuwait Mil_KAF327=011100000110000111110110,24,Kuwait_Mil.bmp
Kuwait Mil_KAF328=011100000110000111110111,24,Kuwait_Mil.bmp
Kuwait Mil_KAF342=011100000110001000010111,24,Kuwait_Mil.bmp
Kuwait Mil_KAF343=011100000110001000010110,24,Kuwait_Mil.bmp

Currently I've never had had a code without a flag (that's the kiss of death if ever I heard one).

Somewhere in the past I think I remember seeing that there is a limit to the number of lines you can have in the Countries.dat file???

All the best
DF

  • sbs-1