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

Query with approximate GPS location return 404 #795

Open
ikus060 opened this issue Oct 18, 2022 · 8 comments · May be fixed by #1048
Open

Query with approximate GPS location return 404 #795

ikus060 opened this issue Oct 18, 2022 · 8 comments · May be fixed by #1048
Labels
bug geolocation option-needed A new configuration option needed for this

Comments

@ikus060
Copy link

ikus060 commented Oct 18, 2022

Original Issue

Hello,

I'm testing wttr.in to query the weather for different GPs location. I'm a bit surprise by the behavior I've observe. It seams the API return a 404 error when the GPS location are not identical to a "known" location.

e.g.:

I would expect the coordinate 45.0,-74.0 to return something close to Montreal since it's almost the same.

45.804,-74.0176 is also "close" to Montreal and return not result.
Best would be to return the weather for "Saint-Jérôme" Location.

Proposed Solution

Proposed solution:

We can add a new option geolocation with several possible values:

  • auto -- try to convert, even if it is a pair of coordinates; use the coordinates as a fallback;
  • never -- do not try to convert; use the coordinates directly. If the location is not coordinates, return 404.
  • always -- always try to convert; if the location is not found, even though it is originally coordinates, return 404.

Then you could use geolocation=never and the pair of coordinates, and it would just work.

@chubin
Copy link
Owner

chubin commented Oct 22, 2022

It is a bug. It tries to resolve GPS pair from the query once again, what makes of course no sense at all. Accepted + will be fixed.

@Bwc9876
Copy link

Bwc9876 commented Oct 30, 2023

Any update on this?

@beta-tester
Copy link

i have also issues with GPS coordinates:

this url works: https://wttr.in/52.52045,13.40732

but that not: https://wttr.in/52.52045,13.40731
there is only one 10000'th digit difference

and taking the coordinates that google maps provides, when copy-n-past the coordinates from the map, also doesn't work:
https://wttr.in/52.5205935936161,13.407330726401623

i always get 404:
404 unknown location

@akkaky
Copy link

akkaky commented Dec 12, 2023

Unfortunately, the situation is the same.
https://wttr.in/52.248309,21.01475

выява

@lars-nvhgroup
Copy link

In addition, appending zeros to a known location will fail:
This works:
https://wttr.in/52.52045,13.40732
This throws a 404:
https://wttr.in/52.520450,13.407320

@Tejeev
Copy link

Tejeev commented Dec 12, 2024

Still seeing this. Hope fix gets merged soon

0PandaDEV added a commit to 0PandaDEV/wttr.in that referenced this issue Jan 16, 2025
Fixes chubin#795

This is not finished yet and just a draft with ideas

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/chubin/wttr.in/issues/795?shareId=XXXX-XXXX-XXXX-XXXX).
@0PandaDEV 0PandaDEV linked a pull request Jan 16, 2025 that will close this issue
@chubin
Copy link
Owner

chubin commented Jan 28, 2025

We have several problems here.

  1. Geolocation does not work for certain locations that look like coordinate pairs (but works for some others).
  2. Geolocation may not be really needed when the location is specified as coordinate pairs.

At the moment, the wttr.in service tries to geolocate (resolve into coordinates + human-readable canonical location name) each location, even if it is already a pair of coordinates.

Sometimes it works, sometimes it does not, and if it does not work, a 404 error is returned. That's not something we can control, because the location resolution is done by an external service.

However, what we can control is omitting the resolution if the location is already specified as a pair of coordinates. In this case, there will be no Location: line at the bottom of the forecast, or it will contain only coordinates, but maybe that is okay for the majority of users.

What I propose:

We can add a new option geolocation with several possible values:

  • auto -- try to convert, even if it is a pair of coordinates; use the coordinates as a fallback;
  • never -- do not try to convert; use the coordinates directly. If the location is not coordinates, return 404.
  • always -- always try to convert; if the location is not found, even though it is originally coordinates, return 404.

Then you could use geolocation=never and the pair of coordinates, and it would just work.

Would it be a solution for you?

@Tejeev
Copy link

Tejeev commented Jan 28, 2025

I would be happy with this as a solution

@chubin chubin added the option-needed A new configuration option needed for this label Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug geolocation option-needed A new configuration option needed for this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants