please give me an idea about, how to use latitude and longitude in query for jason format

  • 1
  • Question
  • Updated 4 years ago
Photo of studentgmu

studentgmu

  • 1 Post
  • 0 Reply Likes

Posted 4 years ago

  • 1
Photo of DaveL17

DaveL17

  • 9 Posts
  • 1 Reply Like
You can use latitude/longitude like you would with any other location parameter.

api.wunderground.com/api/API-KEY-GOES-HERE/conditions/q/48.857657,2.295500.json

Just remember to input the lat/long without spaces.
Photo of ParadoxSolver

ParadoxSolver

  • 3 Posts
  • 0 Reply Likes
what about a three day forecast? would i just replace the word 'conditions' with 'forecast'? i thought my free api includes a three day forecast.
Photo of DaveL17

DaveL17

  • 5 Posts
  • 0 Reply Likes
@ParadoxSolver:

There's no need to replace 'conditions' with 'forecast' -- why not have both? Just add 'forecast' to the URL of your API call to Weather Underground, like so:

api.wunderground.com/api/API-KEY-GOES-HERE/conditions/forecast/q/48.857657,2.295500.json

The docs show examples of how each call to the API should be formatted (not all of them are the same) and can be found here: http://www.wunderground.com/weather/a...

Look at the bottoms of the various pages for examples of how each call should be formatted.

Dave
Photo of ParadoxSolver

ParadoxSolver

  • 3 Posts
  • 0 Reply Likes
Please help me Dave,

I just received an email that yesterday I had 505 calls and before yesterday 515. My rain drops covered that...dont know how given I only signed up a few day ago. If the stats are correct for today, I am already up to 700 more on a 500 free account.

The conditions has dew point, wind speed, wind direction and other data.
The forecast has the words for the days and if it is night.

I need both. So will this reduce api calls if i do what you said and then parse my data in to the lists or arrays?

Now I will need the astronomy to determine if sunset occurred to as to know which current or next day/night to display (using just forecast displays the current day daytime forecast even if it is now night time (doesn't bump down to that same day's nighttime) which it not what i want). so either i have to use astronomy to trick the forecast routine or upgrade to the paid account which has auto update current forecast,

bottom line, if i put all of that into one call it will work? please reply. thank you.
Photo of ParadoxSolver

ParadoxSolver

  • 3 Posts
  • 0 Reply Likes
api.wunderground.com/api/API-KEY-GOES-HERE/conditions/forecast/q/48.857657,2.295500.json

i just tried that and i only get one list, conditions. swathing the words doesn't help. so how to do i get these two lists with one call?
Photo of DaveL17

DaveL17

  • 5 Posts
  • 0 Reply Likes
You can combine all into one API call, and that will count as one. So don't make a call for each variable you need, and instead write the JSON data to a variable and then parse the variable.

In Python 2.x for example, I like to use simplejson or BeautifulSoup3 (v4 doesn't work with Python 2.x)

Write the data to 'parsed_simplejson' and then you pull the elements you want out of that with the structure 'humidity=parsed_simplejson['current_observation']['relative_humidity']

Cheers,
Dave
Photo of DaveL17

DaveL17

  • 5 Posts
  • 0 Reply Likes
If you formatted the URL correctly, you should see 'forecast:1' near the top of the response. If you see that, the forecast data should be in there too.