chubin / wttr.in

:partly_sunny: The right way to check the weather
https://wttr.in
Apache License 2.0
24.74k stars 1.11k forks source link

Geolocation queries support #708

Open cornixsenex opened 2 years ago

cornixsenex commented 2 years ago

Add support for geolocation queries:

$ curl -s wttr.in/?format=location | jq .
{
  "latitude": 48.1371079,
  "timezone": "Europe/Berlin",
  "longitude": 11.5753822,
  "address": "München, OB, Bayern, Deutschland"
}

Original message

The weather (in San Francisco) is currently incorrect curl wttr.in is reporting 42F (6C) while other sources (weather.gov, DarkSky, my iPhone etc) are reporting 49F (9-10C) I can confirm it is in fact 49F (9-10C) not 42F (6C) outside at the moment. I've confirmed the error persists on the website as well as the terminal report Any ideas on how to fix this or what's causing the problem?

chubin commented 2 years ago

I think that the problem is with our data source, at least it is how it is reporting it. There are several similar bugs:

https://github.com/chubin/wttr.in/issues?q=is%3Aissue+is%3Aopen+label%3Adata-source

Probably, the only possible solution here, is to add other sources, and make it possible to chose you favorite data source from them.

Also, please check if v2 and v3 reports are better (curl v2.wttr.in, https://v3.wttr.in/San-Francisco), because they are already using other data sources.

hello-smile6 commented 2 years ago

I think that the problem is with our data source, at least it is how it is reporting it. There are several similar bugs:

https://github.com/chubin/wttr.in/issues?q=is%3Aissue+is%3Aopen+label%3Adata-source

Probably, the only possible solution here, is to add other sources, and make it possible to chose you favorite data source from them.

Also, please check if v2 and v3 reports are better (curl v2.wttr.in, https://v3.wttr.in/San-Francisco), because they are already using other data sources.

Is v2 more accurate? I created a library that retrieves geolocation data from wttr.in, and I'd prefer it to be accurate.

chubin commented 2 years ago

geolocation data is the same everywhere. You are just parsing Location: line? If you want, we could create a special query type for you, that would return geolocation data only, without any weather data. It could be JSON-formatted, to avoid any breaking changes in formatting

hello-smile6 commented 2 years ago

geolocation data is the same everywhere. You are just parsing Location: line? If you want, we could create a special query type for you, that would return geolocation data only, without any weather data. It could be JSON-formatted, to avoid any breaking changes in formatting

That would be helpful, especially for people who would like their location in a bash prompt.

chubin commented 2 years ago

Something like this would work for you?

$ curl -s wttr.in/?format=location | jq .
{
  "latitude": 48.1371079,
  "timezone": "Europe/Berlin",
  "longitude": 11.5753822,
  "address": "München, OB, Bayern, Deutschland"
}

(CAUTION: It is not yet implemented! It is just an example)

hello-smile6 commented 2 years ago

Something like this would work for you?

$ curl -s wttr.in/?format=location | jq .
{
  "latitude": 48.1371079,
  "timezone": "Europe/Berlin",
  "longitude": 11.5753822,
  "address": "München, OB, Bayern, Deutschland"
}

(CAUTION: It is not yet implemented! It is just an example)

Yes, especially if it returned the IP address. I could then parse the address string.

chubin commented 2 years ago

So you want to have the IP data too? Not only geolocation data?

hello-smile6 commented 2 years ago

So you want to have the IP data too? Not only geolocation data?

The IP address would be helpful.

chubin commented 2 years ago

Accepted :+1: