Recent Blog Posts RSS
ViaWindowsLive on Via Virtual Earth Blog
The new ViaWindowsLive community site has launched and features not only a definitive set of resources on all Live Services from Microsoft but also a special section on Virtual Earth including a new site gallery for you to upload your sites, new articles on Version 6, including getting started guide, an interactive quick guide, location finder and more. Subscribe to the VWL aggregated blog to stay in touch with everything Live Services related. Find all the great content from this site and much, much more. Explore how other Live Services can compliment Virtual Earth and your applications.
Version 5 URL changed - Error: 'VEMap' is undefined on Via Virtual Earth Blog
It has been reported that the old url to access the Version5 javascript for Virtual Earth no longer works. This is effecting sites worldwide.
The correct way to reference the Version 5 javascript is:
<script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=5"></script>
If you have been effected a forum thread has been started here
Silverlight Virtual Earth viewer on Via Virtual Earth Blog
With the launch of silverlight yesterday I was digging around and found this viewer for Virtual Earth by Greg Schechter. It does use the 1.1 alpha of silverlight. It gives some interesting ideas for where Virtual Earth could be headed. Certainly the demo of the performance of silverlight compared to javascript for processing showed a significant increase. This could be very useful.
And of course on the gamer front check this out by Andy Beaulieu and shoot down some UFO's over Birdseye images.
John.
So much new Virtual Earth Imagery Worldwide. on Via Virtual Earth Blog
I subscribe to all the VE blogs and recently the posts about updated imagery has been more and more frequent.
The latest is here and for myself downunder we saw three updates, Canberra, Newcastle and Uluru:


Derek Chan posts 3 Articles in a month! on Via Virtual Earth Blog
A big thank you to the efforts of Derek Chan who posted his third VE article today (he actually had it ready weeks ago but had to wait for Mr Bottleneck here at VVE ;) )
The 3 articles are all relivant to Version 5 of Virtual Earth and deal with the Mini Map, debugging javascript and now custom pins in routes.
All these can now be found in our articles section.
If you have something to contribute send us an email.
John (The bottleneck)
Integrating Real-time Traffic Information RSS
In the United States Windows Live Local already provides real-time traffic. The data comes from Traffic.com and is available in several Metropolitan Areas:

The implementation in Windows Live Local is very nice and shows the consequences of traffic incidents and construction sites as colour-coded overlay for both sides of the street.

Unfortunately we don’t have these nice overlays outside the US and even if he had, we couldn’t use them in a Virtual Earth custom application. So I was looking for an alternative to provide traffic data for European countries.
A very common source for real-time traffic information is the Traffic Message Channel (TMC) where the coded traffic messages are broadcasted by radio stations over an RDS-channel. This TMC-messages can we received by a TMC-receiver which is often part of Personal Navigation Devices (PND) or in-car navigation systems. Besides the fact that you would need the TMC-receiver the other drawback is that TMC uses a code to compress the message and you would need to decode the message first. Besides that you need a location table to determine the position of the incident.
An easier to use alternative in this scenario has been developed for the European Commission. There are a couple of telemetric services under the roof of CENTRICO (http://www.centrico.org). CENTRICO is a Euroregional Project implementing Intelligent Transport Systems (ITS) to improve the efficiency of the Trans European Road Network (TERN) in order to keep people and goods moving. The CENTRICO project is supported by the DG TREN of the European Commission.
One of CENTRICO’s projects is TIS (Traveller Information Services). It is the policy of most of the CENTRICO authorities that dissemination of traffic information should be eventually left to commercial service-providers. Therefore they put their information available to service providers.
Within TIS there is the OTAP (Open Travel data Access Protocol) project (http://www.itsproj.com/otap). OTAP is an easy access point on the internet where Service Providers can retrieve traffic information from the different TICs (Traffic Information Centres) and other information suppliers within the CENTRICO area. The TICs make their traffic information available through the internet by using standard technology and common formats, especially based on XML and XSD.
Each centre continues to provide and own data for its geographic area and is responsible for the quality of data and service. Contracting procedures and contracts can vary between TICs. The OTAP interface was made as 'easy' as possible by preferring widespread technology with low technological entry threshold and giving highest priority to choices that offer harmonization, minimal costs and maximal stability for both the centres and the service providers.

Quality of data will vary from country to country and so will the cost.
OTAP data is available as XML stream. All of them are already geocoded for the start and end point and a point in the middle of the traffic disturbance. There are different streams for current and future planned events as well as the unplanned events.

On the other site Virtual Earth can consume GeoRSS feeds and overlay the information. So the plan is to use the Extensible Style Language Transformation (XSLT) to transform the XML stream in an GeoRSS feed and consume the feed in Virtual Earth.
Requirements
- To get access to the OTAP XML streams you need to email the contact persons in the country you’re interested in. You will find the contact information here: http://www.itsproj.com/otap/how.html.
- There is a Java SDK for the development with OTAP data but since it is pure XML you can use various coding languages. I used the Microsoft Visual Studio 2005 to receive the XML stream and perform the transformation.
- You just need a text editor to create the file for the XSL Transformation but I used Stylus Studio 2006 XML because it is a very nice and easy to use tool.
- Well and then you need Virtual Earth of cause. There is an excellent interactive SDK and a reference SDK available here: http://dev.live.com/virtualearth/sdk/. Optionally you can download the reference SDK as Windows help-file here: http://go.microsoft.com/?linkid=4932476.
Data Source
Let’s have a look at the data source first. We need to investigate the OTAP XML schema and the required format for the GeoRSS feed. Then we define the mapping rules for an XSLT and finally we write a small program to periodically pull and trans-form the data.
OTAP
You will find the OTAP specifications here: http://www.itsproj.com/otap/otapspec.html.
For this How-To I'm concentrating on the unplanned events only but in a similar fashion we could also retrieve current and future planned events. In the screenshots below you see the XML tree for one incident including the data for the UK. Please note: In the UK there are currently information for the motorways only.
I am using the latitude and longitude of the framed point (the middle of the traffic incident), the description ...

... and the delay caused by this incidents. As you see there are a lot more information and you could you e.g. use the lat/long of start and end point of the incident.

GeoRSS
There are various specifications for GeoRSS feeds. The Virtual Earth map control supports the W3C Basic Geo Vocabulary (see http://www.w3.org/2003/01/geo/). We are using now the WorldKit (http://worldkit.org/doc/rss.php) implementation where we simply need a <geo:lat> and a <geo:long> tag to describe the location.
<?xml version='1.0' ?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
xmlns="http://purl.org/rss/1.0/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<item>
<title>M6 southbound between J10 and J9</title>
<description>PT10M</description>
<geo:lat>52.572115</geo:lat>
<geo:long>-2.012080</geo:long>
</item>
</rdf:RDF>
XSL Transformation
Using Stylus Studio 2006 XML we define the mapping rules for the XSL Transformation.

The XSL-file will look like this:
<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
xmlns="http://purl.org/rss/1.0/">
<xsl:for-each select="situationPublication/situation/situationElement">
<item>
<title>
<xsl:value-of select="elementlocation/framedPoint/name/descriptor"/>
</title>
<description>
<xsl:value-of select="consequence/delay/delayTimeValue"/>
</description>
<geo:lat>
<xsl:value-of select="elementlocation/framedPoint/wgs84/latitude"/>
</geo:lat>
<geo:long>
<xsl:value-of select="elementlocation/framedPoint/wgs84/longitude"/>
</geo:long>
</item>
</xsl:for-each>
</rdf:RDF>
</xsl:template>
</xsl:stylesheet>
Bringing it all together
Now that we know the source OTAP-format and destination GeoRSS-format and we defined the rules for the XSL transformation we need to make sure that we pull the data periodically from the OTAP server and apply the transformation.
In Visual Studio 2005 we create a new project for a Windows Application. On the Windows Form we need a button and 2 disabled text boxes.

Basically we create a WebRequest to the OTAP server and capture the response in a data stream. Then we use the XmlTextWriter to write the data stream to the local hard drive into the file OTAPtemp.xml.
Finally we use the XSL file we created earlier in an to transform the OTAPtemp.xml file into the GeoRSS format we need and write it back to the file GeoRSS.xml. The complete process is framed by a Do ... Loop so that we refresh the data every minute. You’ll find the complete code below.
Imports System
Imports System.IO
Imports System.Xml
Imports System.Xml.XPath
Imports System.Xml.Xsl
Imports System.Text
Imports System.Net
Imports System.Threading
Public Class Form1
Private inputfilename As String = "OTAPtemp.xml"
Private outputfilename As String = "GeoRSS.xml"
Private stylesheet As String = "OTAP2GeoRSS.xsl"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer = 0
Do Until txtStatus.Text = "Stopped"
txtStatus.Text = "Reading"
Me.Refresh()
Dim request As WebRequest = WebRequest.Create("http://otap.tistrafficinfo.com/England/UnplannedEvent/content.xml")
Dim myCredentials As New NetworkCredential
myCredentials.UserName = "YOUR_USERNAME"
myCredentials.Password = "YOUR_PASSWORD"
request.Credentials = myCredentials
Dim response As WebResponse = request.GetResponse()
Dim dataStream As Stream = response.GetResponseStream()
Dim reader As New StreamReader(dataStream)
Dim responseFromServer As String = reader.ReadToEnd()
Dim OTAPWriter As New XmlTextWriter(inputfilename, Encoding.UTF8)
OTAPWriter.WriteRaw(responseFromServer)
OTAPWriter.Close()
reader.Close()
response.Close()
Dim xslt As New XslTransform
xslt.Load(stylesheet)
Dim xpathdocument As New XPathDocument(inputfilename)
Dim GeoRSSwriter As New XmlTextWriter(outputfilename, Encoding.UTF8)
GeoRSSwriter.Formatting = Formatting.Indented
xslt.Transform(xpathdocument, Nothing, GeoRSSwriter, Nothing)
GeoRSSwriter.Close()
txtStatus.Text = "Waiting"
i = i + 1
txtCycles.Text = i.ToString + " Cycles"
Me.Refresh()
Thread.Sleep(60000)
Loop
End Sub
End Class
Consuming the GeoRSS Feed in Virtual Earth
Well consuming a GeoRSS feed in Virtual Earth is extremely simple. You only need to make sure that the GeoRSS feed and any images you might want to use can be de-scribed by a URL. I created a Virtual Directory in the Internet Information Service Manager (IIS) MMC and pointed it to the Directory where I periodically write the GeoRSS.xml file.
Then you can create a simple HTML file with the following code. As mentioned earlier you’ll find the complete interactive SDK as well as a reference SDK for Virtual Earth here: http://dev.live.com/virtualearth/sdk/.
Article contributed by Johannes Kebeck. Have you got something to contribute?


