Follow

If you're in the US, the National Weather Service has a very nice api which can be pretty easily queried for data, like forecasts.

See: weather.gov/documentation/serv

You can query the api by latitude,longitude like this:

api.weather.gov/points/17.7275

Here's a rough version of a Common Lisp script I wrote to be able to pull up a forecast quickly:

dpaste.com/2TTN9DP7J

@lisp

(In practice I use a bunch of semi-complicated things to determine my current latitude, longitude, including hard-coded Wi-Fi -> co-ordinates information.

Here the script simply uses ipinfo.io to get the latitude,longitude for your internet service provider. If you're behind a VPN....you'll get the lat,long for your VPN endpoint, unless you exempt the process from your VPN routing.

If you use this frequently, you'll probably want to get an apikey from ipinfo.io and modify the script to use that, otherwise you might run up against ipinfo's rate limits.)

For other parts of the world, you can use Open Weather Map's api (but you'll need to register for a free api key), e.g.:

api.openweathermap.org/data/2.${API_KEY}

@emacsomancer @lisp I use their API pretty heavily for my daily weather reports. It's remarkably easy to work with for a government API.

drwho.virtadpt.net/archive/201

@drwho If you can figure out how to fetch and parse JSON, it's really not too hard.

I've got some other weather things which hook into OpenWeatherMap (which has the advantage of not being restricted to the US), but it's not as nice to work with. (Sometimes it spawns multiple "conditions", which I didn't realise at first.)

@emacsomancer What I find bizarre is as far as I can tell, there's exactly one Android program that actually makes use of this.

@BalooUriza I know. Wx is pretty nice though, but it's odd there aren't more apps which use the API. Maybe because it's US-specific?

@BalooUriza seems to change the current conditions but not the forecast.

@emacsomancer Yeah. It's got a lot of potential but not being able to consistently use a set of units is a wonky showstopper for me. Hopefully that gets fixed, I like overall what it got but it could use a little fit and finish work.

@BalooUriza Yeah, I looked for a place to submit an issue, but their Gitlab doesn't seem to have an issue tracker.

@emacsomancer

yeah I use the National Weather Service's api. It's surprisingly well done. And I don't have to register or use a key. However, I did hit the rate limit quicker than expected, but that's fine, I want to play nice with the free service.

And I'm guessing it doesn't have "wet bias", which a place like Cleveland doesn't need any more of

Sign in to participate in the conversation
types.pl

A Mastodon instance for programming language theorists and mathematicians. Or just anyone who wants to hang out.