Skip to content

Commit fbd700c

Browse files
authored
Update sentinel2.py
adding link for gmaps - closes wildtreetech#37
1 parent a76e1d1 commit fbd700c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

sentinel2.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@ def _cut(s, max_len=72):
120120
return _cut(info["display_name"])
121121

122122

123+
def format_map_url(lat, lng):
124+
return (
125+
"https://www.google.com/maps/@?api=1&map_action=map&zoom=12&"
126+
"basemap=satellite&center={:.2f},{:.2f}".format(lat, lng)
127+
)
128+
129+
123130
def format_lat_lng(lat, lng):
124131
s = ""
125132
if lat < 0:
@@ -339,11 +346,12 @@ def sentinel2_bot(
339346
month = MONTHS[int(date[-4:-2])]
340347
year = date[:4]
341348

342-
MSG = "{location} ({lat_lng}), {date}"
349+
MSG = "{location} ({lat_lng}), {date} @ {url}"
343350
msg = MSG.format(
344351
date="%s %s %s" % (day, month, year),
345352
lat_lng=format_lat_lng(lat, lng),
346353
location=get_address(lat, lng),
354+
url=format_map_url(lat, lng),
347355
)
348356
logging.info("Twitter message: %s" % msg)
349357
delta = period - (time.time() - last_post)

0 commit comments

Comments
 (0)