Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert location text to latitude/longitude for forecast.io backend #87

Open
nikil opened this issue Apr 21, 2016 · 3 comments
Open

Convert location text to latitude/longitude for forecast.io backend #87

nikil opened this issue Apr 21, 2016 · 3 comments

Comments

@nikil
Copy link

nikil commented Apr 21, 2016

Since forecast.io only supports latitude/longitude style locations, it would be nice to have an interface where we could specify a normal location (e.g., "Los Angeles") and have the backend convert automatically to lat/long. When displaying the weather, you could also convert from the lat/long used in the forecast.io lookup back to a canonical location string.

It appears that there's a Go library for just such this purpose: https://github.com/jasonwinn/geocoder

Any chance this could be integrated into wego?

@schachmat
Copy link
Owner

Yep, it's definitely a feature I'm looking into. This was a regression from the worldweatheronline API, which allowed locations specified as city names or even postal codes. A few other possible backends also only support lat,lon-pairs, so it will definitely be added.

I don't like the solution you found, since it has to do another RTT of network traffic before requesting the weather data. A local database would be more fitting.

@pasky
Copy link

pasky commented Apr 26, 2016

How big would such a database be, though? I could ask wego Plavy before, which refers to a village in Czech Republic, and get a sensible reply. Maybe it'd be better to use geocoder, but cache resolved locations in .wegorc.

@schachmat
Copy link
Owner

Caching would be a solution, but it should be done by the geocoder lib, so other projects using that lib can also benefit from the cache. I opened an issue for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants