MapQuest Developer Blog

Click the Map for Weather

It's summer time and no matter where you are, that can mean some pretty interesting weather! Let's explore what we can do to mash-up weather forecasts with MapQuest maps. Step One:  Find a simple weather web service. I like to use the GeoNames web service for two reasons: it's free and in json. Further documentation for the GeoNames weather web service can be found here Click map for weather Step Two:  Get a map from the map constructor ( and create a location. To do this, add a click event listener to the map ( Step Three:  Now grab the lat/lng from the map click event and use it in the GeoNames service request.  You can use your own username! Once you have the weather json response, you can grab the current conditions. I created a simple POI (point of interest) with the station name in the title, and the clouds and temperature in the content window. After adding the POI to the map, the info window is toggled on since it's the only POI on the map. Congratulations: You now have weather on click anywhere in the US! That's all there is to it! You can see it working here