Re: [backstage] Finally, that bloody BBC Weather feed - here it is...

2006-07-28 Thread Oliver Cole
Odd, considering we were like the second place they rolled out the maps?

Oli

On Thu, 2006-07-27 at 21:11 +0100, Michael Pritchard wrote:
 
 On 27/07/06, Phil Winstanley [EMAIL PROTECTED] wrote:
 The Google Geocoding system is pretty crap - it finds Paris
 but not
 London so someone would have to scan through manually and
 fill in the
 gaps if they need the mapping data - I will probably run it
 through QAS, 
 Mappoint or AFD locally for UK places.
 
 
 thats probably because the google geocoder doesn't work in the UK
 yet :)
 
 
 -- 
 -- 
 Michael Pritchard
 Web  :: http://www.blueghost.co.uk
 GMail:: [EMAIL PROTECTED]
 --

-
Sent via the backstage.bbc.co.uk discussion group.  To unsubscribe, please 
visit http://backstage.bbc.co.uk/archives/2005/01/mailing_list.html.  
Unofficial list archive: http://www.mail-archive.com/backstage@lists.bbc.co.uk/


Re: [backstage] Finally, that bloody BBC Weather feed - here it is...

2006-07-28 Thread James Mastros
On Fri, Jul 28, 2006 at 10:04:09PM +0100, Oliver Cole wrote:
 Odd, considering we were like the second place they rolled out the maps?
 
 Oli
I suspect they have four seperate contracts with their upstream data
providers: US, UK, JP, everywhere else.  The US and everywhere else
providers allow for a geocoding API, the UK contract doesn't.  (I
haven't tried JP geocoding, and haven't heard any reports either way.)

-=- James Mastros
-
Sent via the backstage.bbc.co.uk discussion group.  To unsubscribe, please 
visit http://backstage.bbc.co.uk/archives/2005/01/mailing_list.html.  
Unofficial list archive: http://www.mail-archive.com/backstage@lists.bbc.co.uk/


[backstage] Finally, that bloody BBC Weather feed - here it is...

2006-07-27 Thread dotBen (aka Ben Metcalfe)

You'll all be pleased to hear that (probably unintentionally) the BBC
has launched complete RSS and JSON support for it's BBC Weather
service (data provided by the Met Office).

To get straight to the detail, the urls you need are as follows:

http://newsrss.bbc.co.uk/feeds/customisation/v1/weather/4581/json.js

http://newsrss.bbc.co.uk/rss/weather/4581.xml

(Where 4581 is the BBC Weather index for London. You can find out any
other code you need by searching for your city, clicking the desired
result, and identifying the id in the resulting url.)

The important point to note is that the JSON feed is technically
referenced to on the BBC site - if you dig within the JavaScript etc -
but not explicitly referenced for third-party use. The RSS feed,
despite clearly being on the public server, is not currently
referenced from anywhere on the BBC (as far as I can see) and has been
derived from existing logic.

How this was discovered:

The BBC News website now sports a customisable pane that is powered by
JSON. A quick scan of the HTTP Headers shows that the London feed (for
example) is powered by JSON feed at:

http://newsrss.bbc.co.uk/feeds/customisation/v1/weather/4581/json.js
and the London news JSON feed:
http://newsrss.bbc.co.uk/feeds/customisation/v1/newsonline_uk_edition/england/london/json.js

Now I recognised that:

http://newsrss.bbc.co.uk/feeds/customisation/v1/newsonline_uk_edition/england/london/json.js
had some similarities to the original RSS url for the same feed:
http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/england/london/rss.xml

So I used the some pattern logic with the BBC Weather JSON feed:
http://newsrss.bbc.co.uk/feeds/customisation/v1/weather/4581/json.js
to
http://newsrss.bbc.co.uk/rss/weather/4581/rss.xml

However the RSS url didn't work. I then tried removing the slightly
superfluous 'rss.' file name and to my surprise it worked:

http://newsrss.bbc.co.uk/rss/weather/4581.xml

Essentially, I have derived this weather RSS feed purely from
recognising the pattern logic similarities between the BBC News RSS
and JSON feed. I'm making this point clear because I do not believe
the BBC has intended these weather feeds to be public.

Further more, from my knowledge of the BBC and specifically the BBC
Weather relationship with the Met Office, the licence details
contained within the BBC Weather RSS feeds is probably incorrect (it's
just part of the standard RSS template).

So by all means make use of this data into your site/project/mashup,
but be warned this is totally unofficial and presumably could be taken
down at any moment!   I'm probably going to get an email from Tom/Jem
@ BBC too... :)


(From 
http://benmetcalfe.com/blog/index.php/2006/07/27/finally-bbc-weather-rss-and-json-feeds/)

--
dotBen (aka Ben Metcalfe) | e: mashup AT dotben.co.uk

PLEASE NOTE: I no longer work on the backstage.bbc.co.uk project or
for the BBC.  Please email [EMAIL PROTECTED] if you would like to
contact the new project team directly.
-
Sent via the backstage.bbc.co.uk discussion group.  To unsubscribe, please 
visit http://backstage.bbc.co.uk/archives/2005/01/mailing_list.html.  
Unofficial list archive: http://www.mail-archive.com/backstage@lists.bbc.co.uk/


RE: [backstage] Finally, that bloody BBC Weather feed - here it is...

2006-07-27 Thread Phil Winstanley
This is cool.

I wrote a little C# app which iterates through the Id's (counting up),
grabs the XML from the BBC where it can, then looks up the locations
long and lat from google (where it can). Then it stuffs the lot into a
table. (Just replace YourGoogleMapsAPIKey and YourConnectionString) to
get it working.

The Google Geocoding system is pretty crap - it finds Paris but not
London so someone would have to scan through manually and fill in the
gaps if they need the mapping data - I will probably run it through QAS,
Mappoint or AFD locally for UK places.

I've attached a csv of all the values for those interested.

Here's the C#: -

namespace BBCWeather
{
class Program
{
static void Main(string[] args)
{

for (int i = 1000; i  8000; i++) //Limit the range of
number to ones we know have data
{

try
{
XmlDocument Doc = new XmlDocument();
Doc.Load(http://newsrss.bbc.co.uk/rss/weather/; +
i.ToString() + .xml);
Console.WriteLine(i.ToString() + , +
Doc.FirstChild[Location][Values][SiteName].InnerText);

string SQL = (INSERT INTO BBC.dbo.WeatherLocations
(BBCId, SiteName, Country, Continent, Latitude, Longitude) VALUES
(@BBCId, @SiteName, @Country, @Continent, @Latitude, @Longitude));

double Longitude = 0;
double Latitude = 0;

try
{
XmlDocument GeoCode = new XmlDocument();
string Url =
http://maps.google.com/maps/geo?q=; +
Doc.FirstChild[Location][Values][SiteName].InnerText +
output=xmlkey=YourGoogleMapsAPIKey;
GeoCode.Load(Url);

 
Console.WriteLine(GeoCode.ChildNodes[1].InnerXml);

if
(GeoCode.ChildNodes[1][Response][Status][code].InnerText == 200)
{
Longitude =
Convert.ToDouble(GeoCode.ChildNodes[1][Response][Placemark][Point]
[coordinates].InnerText.Split(',')[0]);
Latitude =
Convert.ToDouble(GeoCode.ChildNodes[1][Response][Placemark][Point]
[coordinates].InnerText.Split(',')[1]);
}

}
catch(Exception ex)
{
Console.WriteLine(ex.Message +   +
ex.StackTrace);
//Don't care if it fails right now
}

using (SqlConnection Conn = new
SqlConnection(@YourConnectionString))
using (SqlCommand Comm = new SqlCommand(SQL,Conn))
{
Comm.Parameters.AddWithValue(@BBCId, i);
Comm.Parameters.AddWithValue(@SiteName,
Doc.FirstChild[Location][Values][SiteName].InnerText);
Comm.Parameters.AddWithValue(@Country,
Doc.FirstChild[Location][Values][Country].InnerText);
Comm.Parameters.AddWithValue(@Continent,
Doc.FirstChild[Location][Values][Continent].InnerText);
Comm.Parameters.AddWithValue(@Longitude,
Longitude);
Comm.Parameters.AddWithValue(@Latitude,
Latitude);
Conn.Open();
Comm.ExecuteNonQuery();
Conn.Close();
}

}
catch
{
 Console.WriteLine(i.ToString()); //Just so we can
see it going up - lots of number are blank
}

}



}
}
}

Here's the T-SQL to create the table: -

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[WeatherLocations]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[WeatherLocations](
[Id] [int] IDENTITY(1,1) NOT NULL,
[BBCId] [int] NULL,
[SiteName] [varchar](100) NULL,
[Country] [varchar](100) NULL,
[Continent] [varchar](100) NULL,
[Longitude] [float] NULL,
[Latitude] [float] NULL,
 CONSTRAINT [PK_WeatherLocations] PRIMARY KEY CLUSTERED 
(
[Id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END

Phil.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of dotBen (aka Ben
Metcalfe)
Sent: 27 July 2006 17:45
To: backstage@lists.bbc.co.uk
Subject: [backstage] Finally, that bloody BBC Weather feed - here it
is...

You'll all be pleased to hear that (probably unintentionally) the BBC
has launched complete RSS and JSON support for it's BBC Weather service
(data provided by the Met Office).

To get straight to the detail, the urls you need are as follows:

http://newsrss.bbc.co.uk/feeds/customisation/v1/weather/4581/json.js

http://newsrss.bbc.co.uk/rss/weather/4581.xml

(Where 4581 is the BBC Weather index for London. You can find out any
other code you need by searching

Re: [backstage] Finally, that bloody BBC Weather feed - here it is...

2006-07-27 Thread Michael Pritchard
On 27/07/06, Phil Winstanley [EMAIL PROTECTED] wrote:
The Google Geocoding system is pretty crap - it finds Paris but notLondon so someone would have to scan through manually and fill in thegaps if they need the mapping data - I will probably run it through QAS,
Mappoint or AFD locally for UK places.thats probably because the google geocoder doesn't work in the UK yet :)-- --
Michael PritchardWeb:: http://www.blueghost.co.ukGMail:: [EMAIL PROTECTED]--