简体   繁体   English

Bing Map图钉未显示在Office365 SharePoint页面上

[英]Bing Map pushpins not displaying on an Office365 SharePoint page

I have an Office 365 SharePoint site where I am trying to display data from a list that contains geolocation data using the Bing Maps ajax control ( http://msdn.microsoft.com/en-us/library/gg427610.aspx ). 我有一个Office 365 SharePoint网站,我尝试使用Bing Maps ajax控件( http://msdn.microsoft.com/zh-cn/library/gg427610.aspx )从包含地理位置数据的列表中显示数据。 My map is loading up correctly and displaying the correct location but the actual pushpins are not displaying. 我的地图正在正确加载并显示正确的位置,但未显示实际的图钉。 I've tried default and custom pushpin icons to no avail. 我尝试了默认和自定义图钉图标都没有用。 When I use similar JavaScript on a 'vanilla' html page, the pushpins display just fine so I think there must be some sort of conflict with the SharePoint JavaScript or css. 当我在“原始” html页面上使用类似的JavaScript时,图钉会很好地显示,因此我认为与SharePoint JavaScript或CSS一定存在某种冲突。

Here the relevant block of code: 这里是相关的代码块:

function fillListData(web, list, items) {
    var tile = $("#" + tileId);
    var content = tile.find('.tileContent');
    var mapOptions = {
            credentials: "",
            mapTypeId: Microsoft.Maps.MapTypeId.auto,
            showDashboard: false
            };

    var map = new Microsoft.Maps.Map(content[0], mapOptions);
    var locs = [];

    var e = items.getEnumerator();
    while (e.moveNext()) {

        var listItem = e.get_current();
        var title = listItem.get_item("Title");
        var loc = listItem.get_item("Location");
        var lat = loc.get_latitude();
        var lon = loc.get_longitude();

        var mapLoc = new Microsoft.Maps.Location(lat, lon);

        locs.push(mapLoc);
        //var pin = new Microsoft.Maps.Pushpin(mapLoc, {text: title, visible: true, icon:'../Style Library/Images/flag_red.png'}); 
        //var pin = new Microsoft.Maps.Pushpin(mapLoc, {visible: true, icon:'../Style Library/Images/flag_red.png', width: 50, height: 50}); 
        var pin = new Microsoft.Maps.Pushpin(mapLoc); 
        map.entities.push(pin);
    }

    var bestView = Microsoft.Maps.LocationRect.fromLocations(locs);
    map.setView({bounds:bestView });

}

Any insights are appreciated. 任何见解都表示赞赏。 Thanks. 谢谢。

Double check the lat and lon values. 仔细检查纬度和经度值。 Make sure they actually have a value and that it is a number and not a string. 确保它们实际上有一个值,并且它是一个数字而不是字符串。 If it is a string use parseFloat to convert it to a number. 如果是字符串,请使用parseFloat将其转换为数字。 Numbers that are stored as a string is a fairly common cause for pushpins not displaying as the Location class ends up being invalid. 存储为字符串的数字是导致图钉不显示的相当普遍的原因,因为Location类最终无效。

如果其他任何人遇到此问题,请进入您的Internet设置,降低保护级别,然后进入“自定义级别”,找到“启用混合内容”,然后启用这已成为此处两台计算机的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM