Weather Underground and Google map

  • 1
  • Question
  • Updated 5 years ago
How can I link the google map with the weather api , so when I click on the map I get the weather of the place...it is possible ?

I mean there is a code that take the coordinates (lat,lon) of google map and transform in a zip code to retrieve the info from wunderground?
Photo of Vlizzard

Vlizzard

  • 1 Post
  • 0 Reply Likes

Posted 5 years ago

  • 1
Photo of afelicioni

afelicioni

  • 227 Posts
  • 43 Reply Likes
I think would be easier to query directly WU api using latitude and longitude returned by a callback function you can attach to a click event via google.maps.event.addListener or something.

For instance, you could play with getPosition method of a dynamic or draggable marker, that returns an object containing latitude and longitude information; lately, you can raise a WU api call (maybe with json output) and perform a data parse, related to that marker position.
Photo of Brendan Hayes

Brendan Hayes, Official Rep

  • 962 Posts
  • 122 Reply Likes
You can pass lat/lon to the API and it will give you back the weather, it doesn't have to be zip code