Click to Rate and Give Feedback
MSDN
MSDN Library
Bing Services
Bing Maps SDKs
VEMap Class
VEMap Methods
 ImportShapeLayerData Method

  Switch on low bandwidth view
VEMap.ImportShapeLayerData Method

Imports data from a GeoRSS feed, Bing Maps (http://maps.live.com) collection, or KML URL.

VEMap.ImportShapeLayerData(shapeSource, callback, setBestView);

Parameters

Parameter Description

shapeSource

A VEShapeSourceSpecification Class object specifying the imported shape data.

callback

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

setBestView

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

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.

JScript
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title></title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

      <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2"></script>

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

         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.');
         }
      </script>
   </head>
   <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" 
         onclick="AddMyLayer(VEDataType.VECollection);">
   </body>
</html>
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker