Skip to content

Commit

Permalink
Update sentinel2.py
Browse files Browse the repository at this point in the history
adding link for gmaps
- closes wildtreetech#37
  • Loading branch information
kmader authored Aug 15, 2019
1 parent a76e1d1 commit fbd700c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion sentinel2.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ def _cut(s, max_len=72):
return _cut(info["display_name"])


def format_map_url(lat, lng):
return (
"https://www.google.com/maps/@?api=1&map_action=map&zoom=12&"
"basemap=satellite&center={:.2f},{:.2f}".format(lat, lng)
)


def format_lat_lng(lat, lng):
s = ""
if lat < 0:
Expand Down Expand Up @@ -339,11 +346,12 @@ def sentinel2_bot(
month = MONTHS[int(date[-4:-2])]
year = date[:4]

MSG = "{location} ({lat_lng}), {date}"
MSG = "{location} ({lat_lng}), {date} @ {url}"
msg = MSG.format(
date="%s %s %s" % (day, month, year),
lat_lng=format_lat_lng(lat, lng),
location=get_address(lat, lng),
url=format_map_url(lat, lng),
)
logging.info("Twitter message: %s" % msg)
delta = period - (time.time() - last_post)
Expand Down

0 comments on commit fbd700c

Please sign in to comment.