Explore DXCC in Google Earth

Tagged:

I love geography, I love explore world in Google earth and I love hamradio. After years, I can't still say I know all prefixes of DXCC entities. So, I got idea write simple python script and put DXCC entities into Google earth and start explore. If you have same passions, lets download pfx.kmz and open GE

And here script.
You need download cty.dat.

  1. import re
  2.  
  3. def load_dxcc(cty_file='cty.dat'):
  4.     txt = open(cty_file).read()
  5.     raw = re.findall(r'([\w\d.\-&() ]+):\s*(\S+):\s*(\S+):\s*(\S+):\s*(\S+):\s*(\S+):\s*(\S+):\s*(\S+):(.*?);', txt , re.S)
  6.     return raw
  7.  
  8. kml = open('pfx.kml','w')
  9.  
  10. kml.write('''<?xml version="1.0" encoding="UTF-8"?>
  11. <kml xmlns="http://www.opengis.net/kml/2.2">
  12.  <Document>''')
  13.  
  14. dxcc = load_dxcc("cty.dat")
  15.  
  16. pfx = {}
  17. for e in dxcc:    
  18.     if not pfx.has_key(e[7]):
  19.         pfx[e[7]] = [e[4],str(-1*float(e[5])),e[0]]
  20.        
  21. for e in pfx:    
  22.     kml.write('   <Placemark>\n')
  23.     kml.write('     <name>%s</name>\n' % e)
  24.     kml.write('     <description><![CDATA[%s]]></description>\n' % pfx[e][2] )
  25.     kml.write('     <Style>\n')
  26.     kml.write('     <IconStyle>\n')
  27.     kml.write('          <scale>1.7</scale>\n')
  28.     kml.write('          <Icon>\n')
  29.     kml.write('            <href>http://maps.google.com/mapfiles/kml/paddle/ltblu-stars.png</href>\n')
  30.     kml.write('          </Icon>\n')
  31.     kml.write('        </IconStyle>\n')
  32.     kml.write('     </Style>\n')
  33.     kml.write('     <Point>\n')
  34.     kml.write('        <coordinates>%s,%s</coordinates>\n' % (pfx[e][1],pfx[e][0]))
  35.     kml.write('     </Point>\n')
  36.     kml.write('   </Placemark>\n')
  37.  
  38. kml.write('''  </Document>
  39. </kml>''')
  40. kml.close()