Virtual Earth API: Adding a GeoRSS Layer Without an Automatic View Update

When adding a GeoRSS layer to the map, the current map view gets updated automatically so the best view of the GeoRSS layer is visible.  However, several people have asked how to disable this since they are adding several layers to the map or already had the map in the view they wanted.  We are planning to add this support into a future API release, however until then there is a workaround.

For the workaround, you have to temporarily override the internal SetBestMapView function before adding the layer.  After the GeoRSS layer is loaded, you can then restore the original SetBestMapView function.

The code below shows an example assuming you have a VEMap instance named "map":

//Store the original SetBestMapView
var originalSetBestMapViewFunc = map.vemapcontrol.SetBestMapView;

//Temporarily override the SetBestMapView with an empty function
map.vemapcontrol.SetBestMapView = function(){};

//Setup a callback which will restore the original SetBestMapView
function fnCallback()
     map.vemapcontrol.SetBestMapView = originalSetBestMapViewFunc;

//Add the GeoRSS Layer with the callback
var s = new VELayerSpecification(VELayerType.GeoRSS, "1", "
http://.../mygeorss.xml", "get", fnCallback);

Comments (3)

  1. This is pretty cool. As you know ArcWeb Explorer now supports the use of GeoRSS with the Javascript API.

  2. Microsoft Virtual Earth API 3.0中新增的一项强大的功能使用GeoRSS,GeoRSS提供了一种地理位置搜索与聚合的方案,并且可以用于地理分析,例如在指定地点10公里范围内,所有可能受地震影响的地物的信息,在自己出行道路中出现交通事故的位置点,等等。只要RSS包含了地理位置信息,就可以将应用进行扩展。GeoRSS层可以很容易的使用基于WGS84

  3. Keith Kinnan says:

    With the v5 Release of the Virtual Earth API, you no longer have to do this.  There is now a boolean flag on the ImportShapeLayerData method which allows you to specify whether you want a map view update when the GeoRSS Layer loads. See this post:

Skip to main content