开发者

how to create a custom pin on Bing maps v7

Can someone show me how to custom the pin for Bing maps, version 7.0 please? I'm experimenting with upgrading from version 6 which has a custom icon but I cant find anywhere that shows how to do this with version 7. I have the following code so far.

Many thanks,

var map = null; 
var pinInfobox = null;

function GetMap()
{
    map = new Microsoft.Maps.Map(document.getElementById("myMap"), {
    credentials: "xxx",
    height: 236,
    width: 269,
    enableClickableLogo: false,
    enableSearchLogo: false,
    mapTypeId: Microsoft.Maps.MapTypeId.road,
    showDashboard: false});


    var loc = new Microsoft.Maps.Location(47.592, -122.332);
    var pin = new Microsoft.Maps.Pushpin(loc);
    map.entities.push(pin);
    map.setView({ center: loc, zoom开发者_高级运维: 6 });
}


check out the reference documentation which has an "icon" option to set a custom icon

http://msdn.microsoft.com/en-us/library/gg427629.aspx


There is a really good site that documents how to do this exact operation.

http://www.bingmapsportal.com/isdk/ajaxv7#Pushpins2

Here is the JavaScript from that site that says how to do it:

map.entities.clear(); 
var pushpinOptions = {icon: virtualPath + '/Content/SpaceNeedle.jpg', width: 30, height: 50}; 
var pushpin= new Microsoft.Maps.Pushpin(map.getCenter(), pushpinOptions);
map.entities.push(pushpin);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜