Pushpins are visible while creating cluster on bing map












0















I am facing an issue while creating push-pins clusters on bing map.
I am using the following code for the push-pins and clusters to be shown:



var AllMarkers, map, infobox;
function LoadVehicleMarkers(MarkersData)
{
var vehicles = ;
vehicles = JSON.parse(MarkersData);

AllMarkers=;

for (i = 0; i < vehicles.length; i++) {

var data = vehicles[i];
var col= data.folder;

var iconPath= '../images/vehicles/'+col+'/truck.png';
var pinName= 'pin'+i.toString();
var pin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(data.lat, data.lng), {icon: iconPath, typeName: pinName});

tooltip = new Microsoft.Maps.Infobox(pin.getLocation(), {
visible: false,
showPointer: false,
showCloseButton: false,
offset: new Microsoft.Maps.Point(-75, 10)
});
tooltip.setMap(map);

infobox = new Microsoft.Maps.Infobox(pin.getLocation(), {
visible: false
});
infobox.setMap(map);

pin.metadata = {
title: data.title,
description: data.infowindow
};

Microsoft.Maps.Events.addHandler(pin, 'click', pushpinClicked);
Microsoft.Maps.Events.addHandler(pin, 'mouseover', VehiclepinHovered);
Microsoft.Maps.Events.addHandler(pin, 'mouseout', closeTooltip);

map.entities.push(pin);

AllMarkers.push(pin);
}

Microsoft.Maps.loadModule('Microsoft.Maps.Clustering', function () {

clusterLayer = new Microsoft.Maps.ClusterLayer(AllMarkers, {
clusteredPinCallback: createCustomClusteredPin,
gridSize: 80
});
map.layers.insert(clusterLayer);
});


}
function createCustomClusteredPin(cluster) {
var minRadius = 12;
var outlineWidth = 7;
var clusterSize = cluster.containedPushpins.length;
var radius = Math.log(clusterSize) / Math.log(10) * 5 + minRadius;
var fillColor = 'rgba(255, 40, 40, 0.5)';
if (clusterSize < 10) {
fillColor = 'rgba(20, 180, 20, 0.5)';
}
else if (clusterSize < 100) {
fillColor = 'rgba(255, 210, 40, 0.5)';
}
var svg = ['<svg xmlns="http://www.w3.org/2000/svg" width="', (radius * 2), '" height="', (radius * 2), '">',
'<circle cx="', radius, '" cy="', radius, '" r="', radius, '" fill="', fillColor, '"/>',
'<circle cx="', radius, '" cy="', radius, '" r="', radius - outlineWidth, '" fill="', fillColor, '"/>',
'</svg>'];

cluster.setOptions({
icon: svg.join(''),
anchor: new Microsoft.Maps.Point(radius, radius),
textOffset: new Microsoft.Maps.Point(0, radius - 8)
});
}


Now what I am getting, is a map loaded with clusters with count, but the push-pins are still visible (as seen in the following image:)



Map Screen Shot



Please help me with this.
I want to create clusters for vehicle pushpins only.
Any help on this will be appreciated.










share|improve this question

























  • can anyone help ?

    – DeepakVerma
    Jan 3 at 17:26
















0















I am facing an issue while creating push-pins clusters on bing map.
I am using the following code for the push-pins and clusters to be shown:



var AllMarkers, map, infobox;
function LoadVehicleMarkers(MarkersData)
{
var vehicles = ;
vehicles = JSON.parse(MarkersData);

AllMarkers=;

for (i = 0; i < vehicles.length; i++) {

var data = vehicles[i];
var col= data.folder;

var iconPath= '../images/vehicles/'+col+'/truck.png';
var pinName= 'pin'+i.toString();
var pin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(data.lat, data.lng), {icon: iconPath, typeName: pinName});

tooltip = new Microsoft.Maps.Infobox(pin.getLocation(), {
visible: false,
showPointer: false,
showCloseButton: false,
offset: new Microsoft.Maps.Point(-75, 10)
});
tooltip.setMap(map);

infobox = new Microsoft.Maps.Infobox(pin.getLocation(), {
visible: false
});
infobox.setMap(map);

pin.metadata = {
title: data.title,
description: data.infowindow
};

Microsoft.Maps.Events.addHandler(pin, 'click', pushpinClicked);
Microsoft.Maps.Events.addHandler(pin, 'mouseover', VehiclepinHovered);
Microsoft.Maps.Events.addHandler(pin, 'mouseout', closeTooltip);

map.entities.push(pin);

AllMarkers.push(pin);
}

Microsoft.Maps.loadModule('Microsoft.Maps.Clustering', function () {

clusterLayer = new Microsoft.Maps.ClusterLayer(AllMarkers, {
clusteredPinCallback: createCustomClusteredPin,
gridSize: 80
});
map.layers.insert(clusterLayer);
});


}
function createCustomClusteredPin(cluster) {
var minRadius = 12;
var outlineWidth = 7;
var clusterSize = cluster.containedPushpins.length;
var radius = Math.log(clusterSize) / Math.log(10) * 5 + minRadius;
var fillColor = 'rgba(255, 40, 40, 0.5)';
if (clusterSize < 10) {
fillColor = 'rgba(20, 180, 20, 0.5)';
}
else if (clusterSize < 100) {
fillColor = 'rgba(255, 210, 40, 0.5)';
}
var svg = ['<svg xmlns="http://www.w3.org/2000/svg" width="', (radius * 2), '" height="', (radius * 2), '">',
'<circle cx="', radius, '" cy="', radius, '" r="', radius, '" fill="', fillColor, '"/>',
'<circle cx="', radius, '" cy="', radius, '" r="', radius - outlineWidth, '" fill="', fillColor, '"/>',
'</svg>'];

cluster.setOptions({
icon: svg.join(''),
anchor: new Microsoft.Maps.Point(radius, radius),
textOffset: new Microsoft.Maps.Point(0, radius - 8)
});
}


Now what I am getting, is a map loaded with clusters with count, but the push-pins are still visible (as seen in the following image:)



Map Screen Shot



Please help me with this.
I want to create clusters for vehicle pushpins only.
Any help on this will be appreciated.










share|improve this question

























  • can anyone help ?

    – DeepakVerma
    Jan 3 at 17:26














0












0








0








I am facing an issue while creating push-pins clusters on bing map.
I am using the following code for the push-pins and clusters to be shown:



var AllMarkers, map, infobox;
function LoadVehicleMarkers(MarkersData)
{
var vehicles = ;
vehicles = JSON.parse(MarkersData);

AllMarkers=;

for (i = 0; i < vehicles.length; i++) {

var data = vehicles[i];
var col= data.folder;

var iconPath= '../images/vehicles/'+col+'/truck.png';
var pinName= 'pin'+i.toString();
var pin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(data.lat, data.lng), {icon: iconPath, typeName: pinName});

tooltip = new Microsoft.Maps.Infobox(pin.getLocation(), {
visible: false,
showPointer: false,
showCloseButton: false,
offset: new Microsoft.Maps.Point(-75, 10)
});
tooltip.setMap(map);

infobox = new Microsoft.Maps.Infobox(pin.getLocation(), {
visible: false
});
infobox.setMap(map);

pin.metadata = {
title: data.title,
description: data.infowindow
};

Microsoft.Maps.Events.addHandler(pin, 'click', pushpinClicked);
Microsoft.Maps.Events.addHandler(pin, 'mouseover', VehiclepinHovered);
Microsoft.Maps.Events.addHandler(pin, 'mouseout', closeTooltip);

map.entities.push(pin);

AllMarkers.push(pin);
}

Microsoft.Maps.loadModule('Microsoft.Maps.Clustering', function () {

clusterLayer = new Microsoft.Maps.ClusterLayer(AllMarkers, {
clusteredPinCallback: createCustomClusteredPin,
gridSize: 80
});
map.layers.insert(clusterLayer);
});


}
function createCustomClusteredPin(cluster) {
var minRadius = 12;
var outlineWidth = 7;
var clusterSize = cluster.containedPushpins.length;
var radius = Math.log(clusterSize) / Math.log(10) * 5 + minRadius;
var fillColor = 'rgba(255, 40, 40, 0.5)';
if (clusterSize < 10) {
fillColor = 'rgba(20, 180, 20, 0.5)';
}
else if (clusterSize < 100) {
fillColor = 'rgba(255, 210, 40, 0.5)';
}
var svg = ['<svg xmlns="http://www.w3.org/2000/svg" width="', (radius * 2), '" height="', (radius * 2), '">',
'<circle cx="', radius, '" cy="', radius, '" r="', radius, '" fill="', fillColor, '"/>',
'<circle cx="', radius, '" cy="', radius, '" r="', radius - outlineWidth, '" fill="', fillColor, '"/>',
'</svg>'];

cluster.setOptions({
icon: svg.join(''),
anchor: new Microsoft.Maps.Point(radius, radius),
textOffset: new Microsoft.Maps.Point(0, radius - 8)
});
}


Now what I am getting, is a map loaded with clusters with count, but the push-pins are still visible (as seen in the following image:)



Map Screen Shot



Please help me with this.
I want to create clusters for vehicle pushpins only.
Any help on this will be appreciated.










share|improve this question
















I am facing an issue while creating push-pins clusters on bing map.
I am using the following code for the push-pins and clusters to be shown:



var AllMarkers, map, infobox;
function LoadVehicleMarkers(MarkersData)
{
var vehicles = ;
vehicles = JSON.parse(MarkersData);

AllMarkers=;

for (i = 0; i < vehicles.length; i++) {

var data = vehicles[i];
var col= data.folder;

var iconPath= '../images/vehicles/'+col+'/truck.png';
var pinName= 'pin'+i.toString();
var pin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(data.lat, data.lng), {icon: iconPath, typeName: pinName});

tooltip = new Microsoft.Maps.Infobox(pin.getLocation(), {
visible: false,
showPointer: false,
showCloseButton: false,
offset: new Microsoft.Maps.Point(-75, 10)
});
tooltip.setMap(map);

infobox = new Microsoft.Maps.Infobox(pin.getLocation(), {
visible: false
});
infobox.setMap(map);

pin.metadata = {
title: data.title,
description: data.infowindow
};

Microsoft.Maps.Events.addHandler(pin, 'click', pushpinClicked);
Microsoft.Maps.Events.addHandler(pin, 'mouseover', VehiclepinHovered);
Microsoft.Maps.Events.addHandler(pin, 'mouseout', closeTooltip);

map.entities.push(pin);

AllMarkers.push(pin);
}

Microsoft.Maps.loadModule('Microsoft.Maps.Clustering', function () {

clusterLayer = new Microsoft.Maps.ClusterLayer(AllMarkers, {
clusteredPinCallback: createCustomClusteredPin,
gridSize: 80
});
map.layers.insert(clusterLayer);
});


}
function createCustomClusteredPin(cluster) {
var minRadius = 12;
var outlineWidth = 7;
var clusterSize = cluster.containedPushpins.length;
var radius = Math.log(clusterSize) / Math.log(10) * 5 + minRadius;
var fillColor = 'rgba(255, 40, 40, 0.5)';
if (clusterSize < 10) {
fillColor = 'rgba(20, 180, 20, 0.5)';
}
else if (clusterSize < 100) {
fillColor = 'rgba(255, 210, 40, 0.5)';
}
var svg = ['<svg xmlns="http://www.w3.org/2000/svg" width="', (radius * 2), '" height="', (radius * 2), '">',
'<circle cx="', radius, '" cy="', radius, '" r="', radius, '" fill="', fillColor, '"/>',
'<circle cx="', radius, '" cy="', radius, '" r="', radius - outlineWidth, '" fill="', fillColor, '"/>',
'</svg>'];

cluster.setOptions({
icon: svg.join(''),
anchor: new Microsoft.Maps.Point(radius, radius),
textOffset: new Microsoft.Maps.Point(0, radius - 8)
});
}


Now what I am getting, is a map loaded with clusters with count, but the push-pins are still visible (as seen in the following image:)



Map Screen Shot



Please help me with this.
I want to create clusters for vehicle pushpins only.
Any help on this will be appreciated.







javascript maps bing






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 3 at 5:41







DeepakVerma

















asked Jan 2 at 14:05









DeepakVermaDeepakVerma

76




76













  • can anyone help ?

    – DeepakVerma
    Jan 3 at 17:26



















  • can anyone help ?

    – DeepakVerma
    Jan 3 at 17:26

















can anyone help ?

– DeepakVerma
Jan 3 at 17:26





can anyone help ?

– DeepakVerma
Jan 3 at 17:26












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54007748%2fpushpins-are-visible-while-creating-cluster-on-bing-map%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54007748%2fpushpins-are-visible-while-creating-cluster-on-bing-map%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

Npm cannot find a required file even through it is in the searched directory