jdemaeyer / brightsky

JSON API for DWD's open weather data.
https://brightsky.dev/
MIT License
287 stars 18 forks source link

[Enhancement] Get weather by city name #121

Closed kwiat1990 closed 2 years ago

kwiat1990 commented 2 years ago

Hi,

I want to thank for the time and effort you put into the project. Great job! I didn't see any issue regarding quiring weather data by city name. Right now, the only option to retrieve data for a specific location is to use geo coordinate. However, in my use case I have only a string with a city name, so the only option for me to make it work involves making another API call (to whatever service allowing such encoding) to retrieve coordinates for the given city name.

Do you have any plans to also allow querying by a name?

jdemaeyer commented 2 years ago

Heyho @kwiat1990

First of all thank you for the kind words, and apologies for the late reply!

I don't think we will incorporate geocoding into Bright Sky. The reason giants like Google and Yahoo offer paid APIs for it is that geocoding is such a major pain in the ass. Given that the geocoding problem is pretty much perpendicular to the problem Bright Sky tries to solve (making awful-to-query-and-parse weather data available in a slightly-easier-to-query-and-parse way), I think the separate API call you mention is actually just a sign of proper separation of concerns.

I realize there are some "poor man's geocoding" solutions we could implement easily, e.g. a simple SELECT * FROM sources WHERE station_name ILIKE '%yourcityname%' query. But these would come with their own set of problems, like figuring out which of the 38 stations you want when searching for "Berlin", or how you can go forward when there are no results - all problems that proper geocoding API services have already solved.

I'm closing this as "wontfix", but feel free to re-open if you disagree hard :)

PS: Nominatim is a geocoding service by the OpenStreetMap folks that's free for "occasional" use.