-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlage_kommuner.py
46 lines (39 loc) · 1.1 KB
/
lage_kommuner.py
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
import requests
import pandas as pd
from bs4 import BeautifulSoup
#from locationfinder import LocationFinder
from svgpathtools import svg2paths
paths, attributes = svg2paths('Norway_municipalities_2012_blank.svg')
for k in range(len(attributes)):
print(attributes[k]['d'])
#
# print(paths)
# bilde = open('Norway_municipalities_2012_blank.svg')
#
# for line in bilde:
# print(line)
# print()
# #url = "http://www.erikbolstad.no/geo/noreg/kommunar/txt/"
# url = "http://www.erikbolstad.no/geo/skandinavia/norske-kommunesenter/txt/"
# r = requests.get(url)
#
# df = pd.read_html(r.text)[0]
#
# kommuner = {}
# for line in df.iterrows():
# #print(len(line), type(line)) #print(line[1][0])
# #print()
# kommuner[line[1][0]] = {
# 'navn': line[1][3],
# 'geoname_id': line[1][2],
# 'Fylkenummer': line[1][4],
# 'Folketal': line[1][6],
# 'lat': line[1][12],
# 'long': line[1][13]
# }
# # print(kommuner)
# sort_kommuner = sorted(kommuner.items(), key=lambda value: -value[1]["lat"])
# #print(sort_kommuner)
#
# for k in sort_kommuner:
# print(k)