Retrieving 10 Day Forecast for station closest to GPS Coordinates

  • 3
  • Question
  • Updated 1 year ago

Hello. I would like to build code which can take GPS coordinates, and return the 10 day forecast for the closest weather station to these coordinates. I have successfully built code which can run the Geo Lookup API call, and also retrieve 10 day forecasts with the forecast10day call. My issue is understanding how to link the two. Taking an example, I call the GPS lookup for somewhere in Norway: latitude = 58.279231; longtitude = 6.892410;. The GPS call returns the list of closest weather stations:

 

It lists the closest city as Oye. However, when I try to then call the 10 day forecast API call for http://api.wunderground.com/api/*MyAPIKey*/hourly10day/q/NO/Oye.json , I get a response of NULL. As opposed to say, http://api.wunderground.com/api/*MyAPIKey*/hourly10day/q/NO/Oslo.json which returns a 10 day forecast with no problems.

How can I get the closest station / city to a given set of GPS Coordinates that *does* have a 10 day forecast available? I don't mind if it's far from the original GPS coordinates, I just want to be sure that I do get a 10 day forecast back.

Thanks!

Photo of Conor Kelly

Conor Kelly

  • 1 Post
  • 0 Reply Likes

Posted 1 year ago

  • 3

Be the first to post a reply!