Explore DXCC in Google Earth
Submitted by ok4bx on Mon, 2013-01-14 21:08
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.
- import re
- def load_dxcc(cty_file='cty.dat'):
- txt = open(cty_file).read()
- raw = re.findall(r'([\w\d.\-&() ]+):\s*(\S+):\s*(\S+):\s*(\S+):\s*(\S+):\s*(\S+):\s*(\S+):\s*(\S+):(.*?);', txt , re.S)
- return raw
- kml = open('pfx.kml','w')
- kml.write('''<?xml version="1.0" encoding="UTF-8"?>
- <kml xmlns="http://www.opengis.net/kml/2.2">
- <Document>''')
- dxcc = load_dxcc("cty.dat")
- pfx = {}
- for e in dxcc:
- if not pfx.has_key(e[7]):
- pfx[e[7]] = [e[4],str(-1*float(e[5])),e[0]]
- for e in pfx:
- kml.write(' <Placemark>\n')
- kml.write(' <name>%s</name>\n' % e)
- kml.write(' <description><![CDATA[%s]]></description>\n' % pfx[e][2] )
- kml.write(' <Style>\n')
- kml.write(' <IconStyle>\n')
- kml.write(' <scale>1.7</scale>\n')
- kml.write(' <Icon>\n')
- kml.write(' <href>http://maps.google.com/mapfiles/kml/paddle/ltblu-stars.png</href>\n')
- kml.write(' </Icon>\n')
- kml.write(' </IconStyle>\n')
- kml.write(' </Style>\n')
- kml.write(' <Point>\n')
- kml.write(' <coordinates>%s,%s</coordinates>\n' % (pfx[e][1],pfx[e][0]))
- kml.write(' </Point>\n')
- kml.write(' </Placemark>\n')
- kml.write(''' </Document>
- </kml>''')
- kml.close()