forked from DL6AKU/CallmapGermany
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakekml.py
More file actions
executable file
·60 lines (46 loc) · 1.69 KB
/
Copy pathmakekml.py
File metadata and controls
executable file
·60 lines (46 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#By Ulrich Thiel, VK2UTL/DK1UT
import sys
import sqlite3
reload(sys)
sys.setdefaultencoding('utf8')
import simplekml
dbconn = sqlite3.connect('calls.db')
dbcursor = dbconn.cursor()
#dbcursor.execute("SELECT * FROM Callsigns WHERE Lng IS NOT NULL AND Lat IS NOT NULL AND Class IS \"A\"")
dbcursor.execute("SELECT 1, Call, Class, Name, Street, Zip, City, Lng, Lat FROM CallsComplete WHERE Lng IS NOT NULL AND Lat IS NOT NULL AND Class IS \"A\"")
res = dbcursor.fetchall()
print str(len(res))+ " class A call signs with geocode"
kml=simplekml.Kml()
for row in res:
address = row[4] + ", " + row[5] + " " + row[6] + ", Germany"
pnt = kml.newpoint()
pnt.name = row[1]+" ("+row[3]+")"
pnt.coords=[(row[7],row[8])]
pnt.address=address
pnt.description = address
if row[2] == "A":
pnt.style.iconstyle.color = simplekml.Color.green
else:
pnt.style.iconstyle.color = simplekml.Color.green
kml.save('calls-A.kml')
#
#dbcursor.execute("SELECT * FROM Callsigns WHERE Lng IS NOT NULL AND Lat IS NOT NULL AND Class IS \"E\"")
dbcursor.execute("SELECT 1, Call, Class, Name, Street, Zip, City, Lng, Lat FROM CallsComplete WHERE Lng IS NOT NULL AND Lat IS NOT NULL AND Class IS \"E\"")
res = dbcursor.fetchall()
print str(len(res))+ " class E call signs with geocode"
kml=simplekml.Kml()
for row in res:
address = row[4] + ", " + row[5] + " " + row[6] + ", Germany"
pnt = kml.newpoint()
pnt.name = row[1]+" ("+row[3]+")"
pnt.coords=[(row[7],row[8])]
pnt.address=address
pnt.description = address
if row[2] == "A":
pnt.style.iconstyle.color = simplekml.Color.red
else:
pnt.style.iconstyle.color = simplekml.Color.green
kml.save('calls-E.kml')
dbconn.close()