-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhw17.1.py
More file actions
25 lines (21 loc) · 746 Bytes
/
hw17.1.py
File metadata and controls
25 lines (21 loc) · 746 Bytes
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
import geocoder
import os
import sys
API_KEY = "f016bc408f5c4914a28115e6d96ec72f"
argInp = []
if __name__ == "__main__":
for param in sys.argv:
argInp.append(param)
lines = []
if (len(argInp) > 2):
lines.append("# {} {}".format(argInp[1], argInp[2]))
else:
with open(os.path.dirname(os.path.abspath(__file__))+'\coords.txt', 'r') as f:
lines = f.readlines()
for line in lines:
x, y = line.split(' ')[1], line.split(' ')[2]
print("Input coords: {:>10}, {:>10}".format(x, y))
location = geocoder.opencage([x, y], method='reverse', key=API_KEY).json['address']
print("Location:", location)
print("GoogleMaps URL:", "https://www.google.com/maps/search/?api=1&query={},{}".format(x,y))
print()