Add GPX generation

This commit is contained in:
jude
2024-02-25 15:11:38 +00:00
parent 3a0a59c76f
commit 0c69ba5d9e
4 changed files with 47 additions and 2 deletions
+9 -2
View File
@@ -29,6 +29,8 @@ def get_megalithic_data(country=1):
'lat': row['lat'],
'lng': row['lng'],
'name': row['Name'],
'type': row['Type'],
'url': 'https://megalithic.co.uk/article.php?sid={}'.format(row['SID']),
})
return data
@@ -52,11 +54,16 @@ def get_stone_circles_data():
data.append({
'lat': item[0],
'lng': item[1],
'name': re.match(r'.+<a .+>(.+)</a>', item[2]).groups()[0],
'name': re.sub(r'<.+?>', '', re.match(r'<b>(.+)</b>', item[2]).groups()[0]),
'type': re.sub(r'.+>', '', item[2].replace('<br>', ' ')),
'url': 'http://www.stone-circles.org.uk/stone/{}'.format(re.search(r'href=([a-zA-Z.]+)', item[2]).groups()[0]),
})
return data
if __name__ == '__main__':
all_data = get_megalithic_data() + get_stone_circles_data()
all_data = get_stone_circles_data() # + get_megalithic_data()
with open('data.json', 'w') as f:
json.dump(all_data, f)