Virtual Earth API: GeoRSS Layers

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.

function onFeed1Load(layer)
     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.

Virtual Earth API GeoRSS Example


For more information regarding the Virtual Earth APIs, see the Virtual Earth Interactive SDK.

Comments (9)

  1. The same way you can import GeoRSS Layers into VEShapeLayers , you can also import any public Virtual

  2. tanvir.huda says:

    Hello Keith

    This is really helpful resource.

    But when i switched to 3D mode it does nt display the custom icon. I have even try to set the full URI but it only displays the default icon.

    s.SetCustomIcon("<img src=’http://localhost/VETest/images/borg.png‘/>");

    can you please let me know how can i display that in 3D mode. That will be much appreciated.



    Tanvir Huda

  3. Gunnar says:


    I have been searching for a way to load a GeoRSS feed into a layer and then iterate through the different pushpins and based on some content in the Description assign it one of several custom icons.

    Each layer is based on events happening in a geographic area. The different events can be of 8 types which is coded in the Description.

    This means that each layer should be able to have pushpins with 8 different icons based on the GeoRSS item description

    Is this possible?


  4. torque says:

    Thanks, that was really helpful!

  5. keithkin says:

    I updated the sample so that it works with Virtual Earth 3D. To show an icon in Virtual Earth 3D, you only need to specify the URL to the icon on the SetCustomIcon call. Previously the SetCustomIcon call was using HTML markup with an IMG tag in the SetCustomIcon to change the image.

  6. Mike McDougall says:


    My company BRIGHTiSolutions recently released a product called GeoFeeder that converts traditional GIS format files to GeoRSS. It works great with Virtual Earth.  You can easily put vector data from kml/kmz, autocad, shape, MapInfo and GML files onto Virtual Earth after conversion.  The demo video on the site uses Virtual Earth.  The map interface is also Virtual Earth based.  Please check it out when you get a chance.



  7. jfrank says:


    I was wondering if you could help me. I added a GeoRss feed to a layer in my map, and i also added some other pushpins manually. When the map is loaded, the pushpins i added manually are sent to the "back" and those from the layer are displayed above. Is there a way to have it the other way, you konw, the pushpins added manually on top of everything else?

  8. The goal of Astoria in V1 is to easily expose a data source using the REST approach to the web (with

  9. lonefire says:

    When I used a GeoRSS Url instead of the xml file name, it gives me a error "Access is denied". Is there any way to avoid this error message? Thanks.

    var geoRssLayer1 = new VEShapeLayer();

    var geoRssLayerSpec1 = new VEShapeSourceSpecification(VEDataType.GeoRSS, ";, geoRssLayer1);

    map.ImportShapeLayerData(geoRssLayerSpec1, onFeed1Load, false);