-
Notifications
You must be signed in to change notification settings - Fork 21
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
Other ways to specify location? #78
Comments
Hello Maybe the zip code could help more for this case as the coordinates needs to click and go to the map to check. |
https://developers.google.com/maps/documentation/geolocation/intro#responses Using geolocation might work, if you can jump to the nearest weather station from that (lat & long). Not sure about zips, maybe there's a lookup table somewhere that crosses them to lat & long. I normally get a full weather forecast from NWS at That is my exact GPS lat & long, I let NWS match it to a forecast. What are the numbers? My station is (maybe) 4830099 or 4950747 or 5157262. That's not the Yahoo woeid is it? My woeid is 12758427 |
OK, user inputs a lat & long or it comes from geolocation (hopefully not geoip: terrible). Some server has all the known weather stations in some big table. 2 binary searches among lat & long data and you've got the 4 nearest weather stations. Present those to the user or use the geometrical distance formula to pick the closest one. It won't need to be done often. |
Great i will add this feature to search by geographic coordinates |
Good geolocation test page (look at the page source). https://benwerd.com/lab/geo.php The API is mostly used by phones with internal GPSes, but at least with Firefox it's possible to set up a file on fixed computers with no GPS that emulates it. And just a pair of edit boxes to input lat & long manually would be useful for when all that's not working or isn't set up. Good app, I'm recommending it on a Raspberry Pi page at https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=227884&p=1397877#p1397877 |
The above page is very usefull in order to get the geolocation, i will check it . |
Could you test the commit below ? Search city by geographic coordinates: |
It sort of works but the cities are wrong. That may happen somewhere else.
I was able to get the match as I type to work for coordinates a
little, but I knew from yesterday that I wanted station code 4950747.
Now that code shows as Shelburne. And when I type the coords into
Google Maps it shows up as Shelburne. Could they have reassigned the
number overnight?
The screenshot from the phone shows the weather station I want at the
red marker. I recognize it, it's at the local postoffice. That's
from typing the coords into Google Maps to see where they actually
point to. My actual location is at the top of the dark blue area at
the bottom of matching.png.
{"location":{"lat":42.650515,"lng":-72.829819},"accuracy":5}
…On 12/12/18, Dimitrios Glentadakis ***@***.***> wrote:
Could you test the commit below ?
Search city by geographic coordinates:
f05b6da
--
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#78 (comment)
--
-------------
No, I won't call it "climate change", do you have a "reality problem"? - AB1JX
Cities are cages built to contain excess people and keep them from
cluttering up nature.
Impeach Impeach Impeach Impeach Impeach Impeach Impeach Impeach
|
I replied to the email because I attached some images. OK, it's picking it up here too. Except not the images. See the end of https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=227884&p=1403190#p1403190 where the images are working. Matching while typing coordinates is maybe a bad idea. I thought close referred to the dialog box not the issue. It's workable. |
That doesn't quite work either. Doing any ASCII search probably won't. Latitude and longitude are originally expressed in degrees, minute and seconds. Computers (mostly) use a decimal number like 42.650515. Each degree is broken into 60 minutes, each of those is 60 seconds. So the decimal is latitude + (minutes/60) + (seconds/3600) (roughly). If you express the coordinates as 2 doubles that's probably close enough, but they need to be numbers, not ASCII. The best discussion I could find quickly is at https://www.wikihow.com/Read-Latitude-and-Longitude-on-a-Map Decimal lat and long: https://www.wikihow.com/Write-Latitude-and-Longitude Trying to use your geolocation interface landed me in New York because it's trying to match latitude first and assumes longitude is less significant. It's 2-dimensional, you can't do that. |
All tests i do work here. I don't understand for the "ascii" part of the question: |
The automatic geolocation doesn't work for you ? |
The "Find my location" icon doesn't work, it says N/A in the top window, "No results" at the bottom. Yet this geolocation test page works https://benwerd.com/lab/geo.php By ASCII I mean letters, words as opposed to numbers. Coordinates are 2 numbers. Trying to "match as typed" can at best match the first one. And my coordinates don't exactly match any weather station's so trying to match characters won't work. You need to treat them as numbers and find the closest ones. It's like X and Y in Cartesian coordinates in math. Matching as text lands me in New York because I'm north of New York by 300 km and it only looks at the first number. Pictures would be easier, but clicking the left icon in that dialog, the one with the magnifying glass and entering my coords as 42.65,-72.83 Those are close but what I use is: Hmm, I made a little HTML file with the http://api.openweathermap.org/data/2.5/find?lat=38.53&lon=-77.0&type=like&mode=xml&APPID=xxxxxxxxxxx URL copied from above and put in my coords and API key. When I click the link in my browser it brings up weather data from 5 cities all on one page: Charlemont, Buckland, Shelburne Falls, Colrain, Shelburne. So if you're using OWM's matching that part works I guess. The geolocation button doesn't work, maybe because it's looking for an exact match and there isn't one. Those 5 cities are all within 15 km or so. But if I type the "lat: N S 42.6734°- lon: E W -72.8218°" coords from above into Google Maps it's under 3 km away and there is a weather station there because that's the one that WeatherBug uses. Town hall, town weather station. Maybe some confusion comes from the fact that I live in a village of 800 people, not a city. OWM may be lumping them all together. But there's a big difference in altitude, I'm 487 meters above sea level, so the weather's different up here. In what I get back in my browser I see that 4950747 is a "city id" by OWM: Shelburne at coord lon="-72.6885" lat="42.5898". So they're grouping Heath into the same city id even though it's 17 km away. That's a problem with Open Weather Maps, not with your program. |
Ok i see For the automatic geolocation i didn't use your site because it needs a click from the web browser (accept geolocation). Probably programmatically i need to make a webbrowser call and simulate the click to accept the geolocation. |
Well I shouldn't need a city, weather came before cities. I like my NWS URL of https://forecast.weather.gov/MapClick.php?lat=42.65050&lon=-72.8298&unit=0&lg=english&FcstType=text&TextType=1 You can edit your (US) coordinates into it and save it, email it, put it in your bookmarks toolbar, etc. Accept geolocation is part of HTML 5 I think. Without that phones could send their locations without the owner's permission, making it possible (easier) to track them. Mine is just the first site I found a few years ago that worked for testing my local json file and Firefox setup so I kept using it. Yours, twice now says "Rate limit exceeded. Upgrade to increase your usage limits at https://ipinfo.io/pricing, or contact us via https://ipinfo.io/contact". Do you need an API key or something? Cookie? Oh well. You don't have a Bitcoin ticker that sits in the tray up your sleeve by any chance? :) ipinfo.io seems to be owned by Google. I was curious to see where it was that such a thing would work. nslookup on ipinfo.io comes back to 216.239.32.21 (and 3 others), then whois on 216.239.32.21 comes back to Google LLC. |
Ok so it is not a good solution this site. I thought that they allow a minimum number of lookups for free. I tested multiple times though without any problem. It may have region or other restrictions (?) Sorry nothing for bitcoin here :( |
It's Google, they're trying to make money off it. There's nothing in the URL to identify a user, maybe they only want to charge people with US IP addresses. Maybe it's because I use ad-blockers so their advertising doesn't load. Anyway it's not rocket science but it does need to run on some server. I wrote this 11 months ago. If I open it as file:/// it doesn't work, but I'm running Apache (and nginx) on this Raspberry Pi. If I open it as http://127.0.0.1/geodemo.html it works. You could put something like it on any server, customize it however you want. It's only a first-time thing anyway, you don't need it often. Hmm, you're using Qt right, do you have a /usr/include/QtLocation directory? I'm not sure what mine came with, I do have QtCreator on here. I've only played with it a couple times. On Linux I wouldn't be sure there isn't something in /proc but only Firefox is looking at my json file, I don't have a real GPS on this. Anyway the HTML, which will probably get mangled by this form. I could email it as an attachment. It tells me: <!doctype html> |
https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/Using_geolocation and It works by doing In Javascript, I don't know about Qt. In the above I don't see anything past the doctype line, that's the first of 53 lines. In Qt look at QGeoLocation QPlace::location() const and GPSLatitude. Qt seems to treat GPS stuff like media stuff. How you fake it if you don't have a GPS connected I don't know. A couple of edit/text boxes or an ini/rc file would work. |
Thanks for the hints |
It seems that this site has also a good detection: https://iplocation.com/ |
On 12/19/18, Dimitrios Glentadakis ***@***.***> wrote:
It seems that this site has also a good detection: https://iplocation.com/
No, I just tried it and it put me in New York City, it's looking at the network connection, not GPS.
Your IP address | 107.242.117.7
40.67
-73.9367
United States
New York
Brooklyn
AT&T Wireless
Because I connect through a cell phone my IP address is usually irrelevant nonsense Brooklyn is 300 km away, 3 1/2 hour drive by car.
Qt seems to be able to read the computer's lat & long without using any browser. Or maybe that's just for EXIF data contained in images.
I just discovered the lat & long end up in ~/.config/meteo-qt/meteo-qt.conf but actually the weather station ID is the most important thing since that's what governs which data gets fetched. The ID= line.
My project BTW: https://sourceforge.net/p/fdf/ (off topic)
…
--
You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub:
#78 (comment)
|
After having added these 2 features:
the basic need has been covered |
Openweathermaps lets you specify a location by city, zip/postal code or lat & long. City,country is particularly inadequate in the US, I see 3 cities in the US with my city name.
The text was updated successfully, but these errors were encountered: