Question

I'm learning Objective-C and I would like to develop an educational/weather app that displays current conditions and severe weather alerts to the user, based on their current location.

To date, I've successfully been able to find the users location and display current conditions sent from Google's Weather API. I've now turned my attention to displaying severe weather alerts, and this is where I've run into a hitch that I can't seem to solve or find elsewhere on StackOverflow.

I've found this NWS Alerts Cap/Atom Service that seems like the way to go, but I don't really understand how to access the alerts in a very general way. The service displays each state and station separately... surely I wouldn't have to iterate through them to find the correct one?

I think my biggest problem right now is figuring out the general way to access the URL for this service. Could anyone offer some insight and perhaps an example of how to do that?

Was it helpful?

Solution

I'm not sure if this will be helpful or not, but this should at least narrow things down by a specific state:

NSString *theCurrentState = @"il"; // lowercase two-letter code

NSURL *theNWSAtomUrl = [NSURL URLWithString:
                              [NSString stringWithFormat: @"http://alerts.weather.gov/cap/%@.php?x=0", theCurrentState]
                       ];

Now, beyond this, the difficulty I see is that you need to parse for both the zone and the county -- that is, some alerts may be issued for the user's county, while others may be issued for the user's general zone. Each has a specific code, and unfortunately, I'm not immediately aware of any way to correlate, say, a zip code to these codes. There's got to be a way, though. This might help, some: http://www.nws.noaa.gov/emwin/winugc.htm

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top