Welcome to Radarspotting. Please login or sign up.

April 19, 2024, 10:51:06 AM

Login with username, password and session length

New Members

New Members

You should get an activation email when you join.  If not, please use the Contact option.

Countries.dat file for Basestation

Started by Roadrunner, May 16, 2017, 07:35:35 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Roadrunner


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


Anmer

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".
Here to Help.

Roadrunner

That was one of the areas that the Radarbox was easier - used the actual codes not hexadecimal versions as does BaseStation!

jakems

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
Steve

Triple7

Just for interest, what does to No. at the end indicate?

China=011110xxxxxxxxxxxxxxxxxx,6,China.bmp

Tim
SBS-1eR, FA ProStick + 1090 filter

jakems

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.
Steve

Anmer

#6
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".  ;)




[Attachment deleted by Admin to save file space]
Here to Help.

Triple7

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, FA ProStick + 1090 filter

jakems

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!
Steve

Anmer

Thanks Steve.  Clearly I'm learning as you explain things  ::)

I made this a Sticky topic.  Too good to lose.  ;)
Here to Help.

Roadrunner


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.

Anmer

Hi Mike

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

Do you know the allocated hex range for China?
Here to Help.

jakems

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
Steve

s92driver

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

David Finch

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