VEMap.ImportShapeLayerData Method

You are not viewing the latest version of the AJAX control. Bing Maps AJAX V7 is the recommended JavaScript control for Bing Maps. If you need this documentation, it is available in as a CHM or PDF download.

Imports data from a GeoRSS feed, Bing Maps ( collection, or KML URL.

VEMap.ImportShapeLayerData(shapeSource, callback, setBestView);


Parameter Description


A VEShapeSourceSpecification Class object specifying the imported shape data.


The function that is called after the data has been imported.


A Boolean value that specifies whether the map view is changed to the best view for the layer.

Return Value

This method returns nothing. The imported data is passed as a VEShapeLayer Class object to the function specified by callback.


If the specified layer has not already been added to the map, this method adds it automatically. If the GeoRSS feed URL, Bing Maps collection GUID, or XML URL is invalid, this method throws an exception.

To set the map view to the best view on the imported shapes, add the shapes to an empty layer.

For more information about supported file formats, see the VEDataType Enumeration topic.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

      <script type="text/javascript" src=""></script>

      <script type="text/javascript">
         var map = null;
         var layerid=1;
         function GetMap()
            map = new VEMap('myMap');

         function AddMyLayer(type)
            var l = new VEShapeLayer();
            var veLayerSpec = new VEShapeSourceSpecification(type, document.getElementById('txtSource').value, l);
            map.ImportShapeLayerData(veLayerSpec, onFeedLoad, 1);

         function onFeedLoad(feed)
            alert('RSS or Collection loaded. There are '+feed.GetShapeCount()+
               ' items in this list.');
   <body onload="GetMap();">
      <div id='myMap' style="position:relative; width:400px; height:400px;"></div>
      <INPUT id="txtSource" type="text" value="546E7E30AC2C5011!451" name="txtSource">
      <INPUT id="loadCollection" type="button" value="Load VE Collection" 

See Also


VEDataType Enumeration


VEShapeSourceSpecification Class