justdave / nwsweatheralertswidget

Android home screen widget to display current weather alerts from the US National Weather Service
http://justdave.github.io/nwsweatheralertswidget/
Apache License 2.0
14 stars 6 forks source link

Allow pulling data for your current location based on GPS #20

Open justdave opened 9 years ago

justdave commented 9 years ago

requested by Ben Spears via Play Store review.

justdave commented 9 years ago

OK, so this turns out to be a hard problem. In order to pull data for a county, I need a three-digit number for the county to give the NWS. These code numbers are pretty much arbitrarily defined (looks like they may have been numbered in alphabetical order in some cases). They have a mapping on their site of county names to code numbers, which the app uses to convert from the county you picked in the settings (the list of counties is also taken from their site, so they match). However I can find nothing for mapping from GPS coordinates to those NWS code numbers. I have found a few free services that'll let me throw GPS coordinates at them and they'll tell me what county those coordinates are in, but I've already noticed a few discrepancies (mostly in semantics or formatting) between the county names returned by those services and the ones in the lookup table on the NWS's website. That means if I use one of these services I'm going to have to make it do some intelligent guessing on which county from the NWS's table is the best match :|

justdave commented 9 years ago

Anyhow, this looks promising: http://www.silverbiology.com/blog/2009/01/26/county-lookup-from-coordinates/

justdave commented 4 years ago

And all of the above is no longer necessary. NWS now has direct support for this in their own API. #36 will fix this.

justdave commented 3 years ago

Correction, #36 will not fix this, but will make the fix substantially easier to implement. :-)