-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhw16.py
More file actions
30 lines (24 loc) · 1.13 KB
/
hw16.py
File metadata and controls
30 lines (24 loc) · 1.13 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
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Ilya Savin Python Homework N16
# ------------------
# Написать программу, которая будет считывать из файла gps координаты,
# и формировать текстовое описание объекта и ссылку на google maps.
# ------------------
from geopy.geocoders import GoogleV3
coordinates = []
apk="AIzaSy" + "CYU5rG2aR" + "pxqBVSe51Et" +"JnmZdc" +"MG0pK" + str(chr(109)) + str(chr(119)) ### VERY DUMMY key protection
with open('coord.txt', 'r') as input_coord:
lines = input_coord.readlines()
for i in range(len(lines) - 1):
x, y = map(float, lines[i].split(', '))
coordinates.append(((x, y)))
input_coord.close()
for x, y in coordinates:
geolocator = GoogleV3(api_key=apk)
print("===================")
print('coordinates: ', x, y)
print('----------------', )
print('Location: ', geolocator.reverse((x, y), language="ru",exactly_one=True))
print(
f'Google Maps URL: https://www.google.com/maps/search/?api={apk}&query={x},{y}')