mirror of
https://github.com/SpudGunMan/meshing-around.git
synced 2026-03-28 17:32:36 +01:00
Update locationdata.py
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
from geopy.geocoders import Nominatim # pip install geopy
|
||||
import maidenhead as mh # pip install maidenhead
|
||||
import requests # pip install requests
|
||||
|
||||
def where_am_i(lat=0, lon=0):
|
||||
whereIam = ""
|
||||
@@ -28,4 +29,16 @@ def where_am_i(lat=0, lon=0):
|
||||
grid = mh.to_maiden(float(lat), float(lon))
|
||||
whereIam += " Grid:" + grid
|
||||
|
||||
return whereIam
|
||||
return whereIam
|
||||
|
||||
def get_tide(lat=0, lon=0):
|
||||
station_lookup_url = "https://api.tidesandcurrents.noaa.gov/mdapi/prod/webapi/stations.json?lat=" + lat + "&lon=" + lon + "&radius=30"
|
||||
station_data = requests.get(station_lookup_url, timeout=5)
|
||||
if(station_data.ok):
|
||||
station_json = station_data.json()
|
||||
print(station_json)
|
||||
station_id = station_json['stationList'][0]['stationId']
|
||||
else:
|
||||
return "error fetching station data"
|
||||
|
||||
return "tide data"
|
||||
Reference in New Issue
Block a user