admin管理员组文章数量:1315345
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 });
}
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 });
}
Share
Improve this question
edited Dec 10, 2013 at 7:37
Kara
6,22616 gold badges53 silver badges58 bronze badges
asked May 25, 2011 at 11:40
James RadfordJames Radford
4234 gold badges7 silver badges13 bronze badges
2 Answers
Reset to default 3check out the reference documentation which has an "icon" option to set a custom icon
http://msdn.microsoft./en-us/library/gg427629.aspx
There is a really good site that documents how to do this exact operation.
http://www.bingmapsportal./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);
本文标签: javascripthow to create a custom pin on Bing maps v7Stack Overflow
版权声明:本文标题:javascript - how to create a custom pin on Bing maps v7 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741969764a2407763.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论