Fix Kuntakartta.py for new format
This commit is contained in:
parent
d7aaaa9ec2
commit
ecaed7d951
1 changed files with 10 additions and 10 deletions
|
@ -39819,22 +39819,26 @@ if rawgeocachefi == "[LIITÄ LÖYTÖTAULUKKO PAIKKAKUNNITTAIN TÄHÄN]":
|
||||||
print("""'Löytötaulukko paikkakunnittain' puuttuu""")
|
print("""'Löytötaulukko paikkakunnittain' puuttuu""")
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
otsikko = rawgeocachefi[rawgeocachefi.find('Sija\t'):rawgeocachefi.find('Yht.\n')+4]
|
otsikko = rawgeocachefi[rawgeocachefi.find('Paikkakunta\t'):rawgeocachefi.find('Eri\n')+4]
|
||||||
stats = rawgeocachefi[rawgeocachefi.find('1.\t'):rawgeocachefi.find('\n',rawgeocachefi.find(kuntia+"."))].replace(otsikko+'\n',"")
|
stats = rawgeocachefi[rawgeocachefi.find('Akaa\t'):rawgeocachefi.find('\n',rawgeocachefi.find("Äänekoski"))].replace(otsikko+'\n',"")
|
||||||
sarake = otsikko.split('\t')
|
sarake = otsikko.split('\t')
|
||||||
|
|
||||||
k, A = 1, 0
|
k, A = 1, 0
|
||||||
while k <= int(kuntia):
|
while k <= int(kuntia):
|
||||||
A = stats.find(str(k)+'.'+'\t', A)
|
if k > 1:
|
||||||
|
A = stats.find('\n', A) + 1
|
||||||
|
|
||||||
if k != int(kuntia):
|
if k != int(kuntia):
|
||||||
B = A + stats[A:].find('\n')
|
B = A + stats[A:].find('\n')
|
||||||
else:
|
else:
|
||||||
B = len(stats)
|
B = len(stats)
|
||||||
kunta = stats[A:B].split('\t')
|
kunta = stats[A:B].split('\t')
|
||||||
|
|
||||||
PAYLOAD = kunta[0]+kunta[1]+' '+sarake[15]+' '+kunta[15]+' /'
|
PAYLOAD = kunta[0]+' '+sarake[14]+' '+kunta[14]+' /'
|
||||||
if int(kunta[15]) > 0:
|
if int(kunta[14]) > 0:
|
||||||
COLOR = '#poly-009D57-1-0'
|
COLOR = '#poly-009D57-1-0'
|
||||||
|
if int(kunta[1]) > 0:
|
||||||
|
PAYLOAD = PAYLOAD+'/ '+sarake[1]+' '+kunta[1]+' '
|
||||||
if int(kunta[2]) > 0:
|
if int(kunta[2]) > 0:
|
||||||
PAYLOAD = PAYLOAD+'/ '+sarake[2]+' '+kunta[2]+' '
|
PAYLOAD = PAYLOAD+'/ '+sarake[2]+' '+kunta[2]+' '
|
||||||
if int(kunta[3]) > 0:
|
if int(kunta[3]) > 0:
|
||||||
|
@ -39859,12 +39863,10 @@ while k <= int(kuntia):
|
||||||
PAYLOAD = PAYLOAD+'/ '+sarake[12]+' '+kunta[12]+' '
|
PAYLOAD = PAYLOAD+'/ '+sarake[12]+' '+kunta[12]+' '
|
||||||
if int(kunta[13]) > 0:
|
if int(kunta[13]) > 0:
|
||||||
PAYLOAD = PAYLOAD+'/ '+sarake[13]+' '+kunta[13]+' '
|
PAYLOAD = PAYLOAD+'/ '+sarake[13]+' '+kunta[13]+' '
|
||||||
if int(kunta[14]) > 0:
|
|
||||||
PAYLOAD = PAYLOAD+'/ '+sarake[14]+' '+kunta[14]+' '
|
|
||||||
else:
|
else:
|
||||||
COLOR = '#poly-DB4436-1-64'
|
COLOR = '#poly-DB4436-1-64'
|
||||||
|
|
||||||
KuntaA = kuntarajat.find('<name>'+kunta[1]+'</name>')
|
KuntaA = kuntarajat.find('<name>'+kunta[0]+'</name>')
|
||||||
|
|
||||||
SplitA = kuntarajat[KuntaA:].find('CDATA[')+KuntaA+6
|
SplitA = kuntarajat[KuntaA:].find('CDATA[')+KuntaA+6
|
||||||
SplitB = kuntarajat[KuntaA:].find(']]></description>')+KuntaA
|
SplitB = kuntarajat[KuntaA:].find(']]></description>')+KuntaA
|
||||||
|
@ -39882,5 +39884,3 @@ tiedosto = "Kuntarajat" + now.strftime("%d%m%Y") + ".kml"
|
||||||
with open(tiedosto, "w") as f:
|
with open(tiedosto, "w") as f:
|
||||||
f.write(kuntarajat)
|
f.write(kuntarajat)
|
||||||
print(kuntarajat)
|
print(kuntarajat)
|
||||||
print('VALMIS')
|
|
||||||
input()
|
|
Loading…
Reference in a new issue