Question

I have created a google map displaying markers and the weather layer using Google Maps API V3.

The weather layer is great for displaying weather information at well-known locations; however, for my map I only care about the wind speed rather than the forecast (ex. sunny, rainy, etc). Is there any way to modify the weather layer so that it displays "wind: s 5m/s" directly on the map instead of the sun/rain icon?

I realize that you can click on the icon to get the wind information but given that we do not care about the actual weather, we do not want people to have to click to get that. Instead we want the wind displayed directly.

(If it is not possible, then any alternative suggestions would be greatly appreciated as well :) )

Was it helpful?

Solution

I've tried but haven't found a way to change how the weather icons look when they are loaded.

It is possible (as you may know) to create a custom overlay using discrete weather data items (like wind speed) when a weather icon is clicked but that wouldn't seem to solve your problem.
See" "google.maps.weather.WeatherConditions object specification" in the V3 API reference

Like many of these kinds of things, I imagine it is theoretically possible to scan the DOM, find the weather 'markers', extract the info you want and redraw them as you wish them to look, but you may (unsure about this) find that the weather icons are actually images and data like wind speed doesn't actually exist in the DOM until the weather icon is clicked: The discrete data may be the product of an ajax load in response to the click event. Even if you got a DOM crawler to work it could be broken by a new release of the API and you'd never know what hit you.

Best bet may be to submit a change request to the API developers asking for the ability to format the weather icons and specify their content.

or

Use some other online source of json or xml weather data and create your own weather markers, labels, or whatever on your map.

Sorry I can't provide a more constructive answer :-(

OTHER TIPS

I made a Weather API available on mashape, and they have a ready to use simple PHP SDK. This api is really simple to use because we use the cool standards that are available nowadays, like JSON and REST.

If you like it please give it a try on mashape

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