【问题标题】:how do i use images from the www in bing maps (win8)我如何在必应地图(win8)中使用来自 www 的图像
【发布时间】:2012-10-15 10:01:13
【问题描述】:

我的目标是创建一个带有一些图钉的 bing 地图。

所以我有以下功能:

function addPushPin(pos, merchantId) {
    var pin = new Microsoft.Maps.Pushpin({ latitude: pos.latitude, longitude: pos.longitude }, {
        icon: 'http://.../'+merchantId+'.png'
    });
    map.entities.push(pin);
}

但是,必应地图似乎无法从 www 加载图像。 (我用本地图片试了一下,效果很好)

图标网址很好。如果我将其复制粘贴到浏览器中,我可以看到图像,但我无法在我的 bing 地图中显示它。

知道为什么吗?我能做什么works

【问题讨论】:

    标签: javascript windows-8 bing-maps


    【解决方案1】:

    它应该与 URL 一起正常工作。

    要使用 URL 进行测试,请转到 Bing 地图门户 URL(图钉示例)

    http://www.bingmapsportal.com/ISDK/AjaxV7#Pushpins2

    在页面底部,您将看到一个示例。将图标 url 替换为您自己的 http URL,单击“运行”按钮,您将看到您的 Pushpin 将从您的 url 加载。

    例子

    map.entities.clear(); 
    var pushpinOptions = {icon: 'http://mapicons.nicolasmollet.com/wp-content/uploads/mapicons/shape-default/color-3875d7/shapecolor-white/shadow-1/border-color/symbolstyle-color/symbolshadowstyle-no/gradient-no/exchequer.png', width: 30, height: 50}; 
    var pushpin= new Microsoft.Maps.Pushpin(map.getCenter(), pushpinOptions);
    map.entities.push(pushpin);
    

    【讨论】:

    • 我只是忘了设置高度和宽度。我以为它会自动设置它。
    猜你喜欢
    • 1970-01-01
    • 2020-05-26
    • 2016-11-29
    • 2023-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多