It seems that there is one more bug. Polylines are disappearing if they are too big (i.e polyline which connects London with Sardinia) and if you zoom it.

Example you can see here, just zoom one line, zoom it until it disappears.

Also, in that file you can see example of adding viewchangeend event, which is fired also when zoom changes:

Microsoft.Maps.Events.addHandler(myMap, 'viewchangeend', addPins);

Then adding polylines:

var point1 = new Microsoft.Maps.Location(55, -2);
var point2 = new Microsoft.Maps.Location(52, -2);
var point3 = new Microsoft.Maps.Location(53, -1);
var point4 = new Microsoft.Maps.Location(37.996162679728116, 8.701171874999998);
var point5 = new Microsoft.Maps.Location(49.26780455063754, 8.701171874999998);

var positions = new Array(

var poly = new Microsoft.Maps.Polyline(


It seems that adding and removing pushpins leads to memory leak.

Example you can see here, in Chrome click shift + esc to see memory consumption.

Also, in that example you can see how to add or remove pushpins:


point = new Microsoft.Maps.Location(getRandomInRange(-180, 180, 3), getRandomInRange(-180, 180, 3));
pin = new Microsoft.Maps.Pushpin(point, {
	text: ('p')



<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>

$(document).ready(function () {

function GetMap() {
    var myMap = new Microsoft.Maps.Map(document.getElementById("mapDiv"), { credentials: "YourKey" });


<div id='mapDiv' style="position:absolute; width:800px; height:600px;"></div>