Bing Map V8 Infobox导致错误

问题描述:

我正尝试将Bing Map V7迁移到V8,同时这样做我正面临显示信息框的问题,该信息框在显示信息框后显示Map SDK的错误。 代码段从应用程序:Bing Map V8 Infobox导致错误

 function DisplayLoc(e) { 
       var map = null; 
       var pinInfobox = null; 
       var pinInfoBox; // the pop up info box 
       var infoboxLayer = new Microsoft.Maps.EntityCollection(); 
       var pinLayer = new Microsoft.Maps.EntityCollection(); 
       var pins = statewithcities; 
       map = new 
       Microsoft.Maps.Map(document.getElementById('bing_map'), { 
        mapTypeId: Microsoft.Maps.MapTypeId.road, 
        showDashboard: false, 
        enableSearchLogo: false, 
        enableClickableLogo: false, 
        showMapTypeSelector: false, 
        showScalebar: false, 
        disablePanning: false, 
        disableZooming: false, 
        showBreadcrumb: false, 
        disableBirdseye: true, 
        showCopyright: false, 
        credentials: mapID 
       }); 
       pinInfobox = new Microsoft.Maps.Infobox(new 
        Microsoft.Maps.Location(0, 0), { 
        visible: false, 
        titleClickHandler: InfoboxHandler 
       }); 
       infoboxLayer.push(pinInfobox); 
       $.each(pins, function(index, pin) { 
       var pinLocation = new Microsoft.Maps.Location(
       pin.latitude, pin.longitude) 
        NewPin.metadata.Title = pin.zipCode; 
        NewPin.metadata.Id = pin.state; 
        NewPin.metadata.Description = "test"; 
        pinLayer.push(NewPin); // add pushpin to pinLayer 
      Microsoft.Maps.Events.addHandler(NewPin, 'click',displayInfobox); 
        map.entities.push(NewPin); 
       }); 
       map.entities.push(pinInfobox); 
       function displayInfobox(e) { 
       if(e.target.metadata){ 
        pinInfobox.setOptions({ 
         id: e.target.metadataId, 
         title: e.target.metadata.Title, 
         description: e.target.metadata.Description, 
         visible: true, 
         offset: new Microsoft.Maps.Point(0, 0), 
         location:e.target.getLocation() 
        }); 
       } 
       } 

请检查和帮助我,因为我不知道在哪里的错误是继兵文档后。

删除下面的代码行:创建信息框:

pinInfobox.setMap(map); 
+0

感谢您的回答后

infoboxLayer.push(pinInfobox); map.entities.push(pinInfobox); 

添加以下代码下面一行,它现在可是信息工作正常盒子插件不与pushpin对齐。可以请你帮我解决 – poojagupta

+0

尝试删除或调整'offset:new Microsoft.Maps.Point(0,0),' – rbrundritt