The v5 Virtual Earth API has improved GeoRSS support. The Virtual Earth API now integrates GeoRSS Layer support with the VEShapeLayer. So, you can now load a GeoRSS layer feed and then access the items in that layer through the VEShapeLayer and VEShape interfaces. The Virtual Earth API supports both the W3C Basic Geo point format and Simple GeoRSS point format. The Virtual Earth v5 API also now supports GeoRSS lines and polygons (<georss:line>, <georss:polygon>).
In order to load a GeoRSS layer, you first have to create a VEShapeLayer and a VEShapeSourceSpecification. The VEShapeSourceSpecification allows you to specify the source type, the shape source, and the shape layer to load the data in. In this example, I set the source type to VEDataType.GeoRSS, specify the URL to the GeoRSS feed as the source, and pass in a reference to the VEShapeLayer:
var geoRssLayer1 = new VEShapeLayer();
var geoRssLayerSpec1 = new VEShapeSourceSpecification(VEDataType.GeoRSS, “1992hurricaneandrew.xml”, geoRssLayer1);
Once the VEShapeLayer and VEShapeSourceSpecification are created, you can then call ImportShapeLayerData on the VEMap to load the data in the layer. The first parameter is the VEShapeSourceSpecification. The second parameter is an optional callback, and the third parameter is a boolean specifying whether or not to set the map view around the points in the layer when the feed loads. In this case, I do not want to change the map view when the feed loads, so I set it to false.
map.ImportShapeLayerData(geoRssLayerSpec1, onFeed1Load, false);
The callback specified to the ImportShapeLayerData will receive a reference to the VEShapeLayer that the feed is loaded in. In this example, I iterate through the VEShapes in the layer by using the GetShapeCount and the GetShapeByIndex methods on the VEShapeLayer, and then I set a custom icon for each of the VEShapes.
var numShapes = layer.GetShapeCount();
for(var i=0; i < numShapes; ++i)
var s = layer.GetShapeByIndex(i);
And that’s it! The GeoRSS feed will appear on the map after a few simple calls. And, once the feed loads, you can access the elements just like any other VEShape on the map.
Here is a link to a complete working example showing GeoRSS layers using two feeds. One feed in a W3C Basic Geo format with 2004 Hurricane Ivan Geo RSS data. The other feed is a Simple GeoRSS format with 1992 Hurricane Andrew GeoRSS data.
For more information regarding the Virtual Earth APIs, see the Virtual Earth Interactive SDK.