||03-19-2013 12:45 PM
Help on finding world weather based on the visitors longitude and latitude?
Anywhere in the world the visitor is on my website, if they give my website permissions, the website will know their longitude and latitude. From this information, I need to find out their:
- Weather - For example: Sunny, Showers
- > Current - Example: 10°C
- > High - Example: 20°C
- > Low - Example: 5°C
- Humidity - Example: 83%
- Visibility - Example: Good
- Pressure (Millibars) - Example: 996
- Wind Direction - Example: ENE
- Wind Speed mph - Example: 2mph
Basically, I need as much information as I can get to be able to show on my own website as you see on: http://www.bbc.co.uk/weather/2643123
The BBC does offer an RSS Feed: http://open.live.bbc.co.uk/weather/f...ayforecast.rss
However I need one which you can use with the visitors longitude and latitude for anywhere in the world and I am not sure if there are any services which provide this, whether I need to include multiple for the different countries or whatnot and could really do with some help.
Thank you for any help and/or advice in answering my question.
||03-19-2013 02:29 PM
How far are you with your script?
Are you at a point where you can use the Google Map V3 locator to provide you with a city and country? Can you demo that for us on a web page?
Once you can get the city and country of a user, it will be easy (easier) to get the weather info.
||03-19-2013 07:45 PM
I am currently setting up a HTML5 Geolocation API on my website. There is currently no live demo which I can yet provide.
||03-20-2013 03:19 AM
Once you can get a country and city, you go to weatherunderground and register for an API key. The key is free to use for up to 500 lookups per day. More than that, you'll need to pay a monthly fee.
A PHP script can use CURL to grab the XML file for your designated city.
Example, when I access this XML file, I get the results shown below:
So with Google Maps locator, you'll need to know the country name ( UK ) and the city ( Manchester ).
Examples in the U.S. would be: /MN/Minneapolis.xml (state/city).
<full>Manchester, United Kingdom</full>
<observation_time>Last Updated on March 20, 12:50 AM GMT</observation_time>
<observation_time_rfc822>Wed, 20 Mar 2013 00:50:00 +0000</observation_time_rfc822>
<local_time_rfc822>Wed, 20 Mar 2013 01:08:22 +0000</local_time_rfc822>
<weather>Mostly Cloudy</weather><temperature_string>37 F (3 C)</temperature_string>
<wind_string>From the East at 8 MPH</wind_string>
<dewpoint_string>32 F (0 C)</dewpoint_string>
windchill_string>31 F (0 C)</windchill_string>
<feelslike_string>31 F (0 C)</feelslike_string>
<precip_1hr_string>-9999.00 in (-9999.00 mm)</precip_1hr_string>
<precip_today_string>0.00 in (0.0 mm)</precip_today_string>
PHP can parse that XML file and dynamically generate any web page you wish. There are many different API reports and data collections to access.
Even if you have to pay a monthly fee, look at how much data you can get.
See this for more info:
||03-20-2013 10:17 AM
check this out.
it says it's depracted, but i see that text since long long time and they don't take it offline, so i guess you can use it for now ;)
it will give you nearest stations to use with mlseim's example ;)
||03-20-2013 01:32 PM
I suppose you could use that 'old' API to get nearby location information based on GPS coordinates. It would take a bit more scripting and still the other API would need to be used for the actual weather reports. A person would have to experiment and see if the Google map locator even gets you close to where you really are.
When I use the Google locator, it sometimes gets me in the Twin Cities (Minnesota) where I'm located. Other times it puts me closer to South Dakota. Even though the location is off by only 300 miles, that makes a difference in the weather. That Google locator thing is just not reliable (in my opinion).
Most people know what city and state (or country) they are currently at. One might think that it would be easiest to just enter that in. We don't know the original intent of the OP.
||03-20-2013 07:29 PM
That could be an interesting one to try. I've never used that one before.
|All times are GMT +1. The time now is 01:06 AM.
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.