我目前正在使用Bing地圖版本8。我以前在使用版本7。在版本7中繪製圖釘時,htmlContent屬性與圖釘一起發送。這個html內容所做的是圖釘被包含在div元素中。確定繪圖後的圖釘 - Bingmaps
var pushpinOptions = {
htmlContent: "<div id='container" + siteIndex + "'style='pointer-events: all !important; z-index: 35000; '></div><div id='lines"+siteIndex+"'></div>",
anchor:new Microsoft.Maps.Point(iconWidth/2,iconHeight/2),
width: iconWidth,
height: iconHeight
};
var pin = new Microsoft.Maps.Pushpin(latLon, pushpinOptions);
我用Konva JS繪製了這些圖釘我繪製與BingMaps。
var stage = new Konva.Stage({
container: 'container' + siteIndex,
width: width,
height: height,
stroke: 'green'
});
「容器」 + siteIndex,是我在Bing地圖圖釘我在konva用於通過圖釘繪製另一個圖像設置div的ID。這是我的要求。我必須繪製帶有座標的圖釘,然後在圖釘上繪製一些圖像。現在,當我由於各種原因從v7切換到v8時,我面臨着一個問題。
在v8 html內容不是與圖釘一起發送的,而是我們發送的svg圖像,在繪製座標之後無法識別座標。
var customHtml = '<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50"><circle id="myCircle htmlId" cx="25" cy="25" r="20" stroke="orange" stroke-width="4" fill="yellow" /></svg>';
var pin = new Microsoft.Maps.Pushpin(latLon, {
icon: customHtml.replace("htmlId",siteIndex.toString()),
anchor: new Microsoft.Maps.Point(iconWidth/2,iconHeight/2)
});
現在,我所lokking的是一種方法,無論是劇情的圖像與第三方API,它繪製了座標或找到辦法讓沒有html內容即我繪製與圖釘的訪問svg圖像。當我訪問與
document.getElementById("myCircle 0");
我得到空。
我已經找過很多不同的第三方apis,像leafleat js,konva js,Graphics js。但我找不到識別我的圖釘的方法。
有沒有辦法實現我想要的?必須有。