Question

I'm following the example here but I don't get to see the text, only the pushpins themselves. What can I be missing?

for (index in centers)
  map.entities.push(new Microsoft.Maps.Pushpin(centers[index]), 
    { text: "A", visible: true, textOffset: new Microsoft.Maps.Point(0, 5) });

The array centers is just a set of points and, since I get the pushpins to appear at the right locations, I believe that the error is in the options.

Note that I'm trying to reuse the default pushpins as far as I can and intentionally omit the custom icon. In case I have to use a custom icon (which would be a shame), where can I find a set of pushpins looking like the default one (possibly in various colors)?

Was it helpful?

Solution

From bing interactive sdk. Just delete the line with the custom pin from you pushpinOptions and you will get the default push pin with text.

The error in you code that you pass the pushpinOptions as parameter to map.entities.push method, but the options is a parameter of new Microsoft.Maps.Pushpin method.

var offset = new Microsoft.Maps.Point(0, 5); 
var pushpinOptions = { text : '1', visible: true, textOffset: offset}; 
var pushpin= new Microsoft.Maps.Pushpin(
  new Microsoft.Maps.Location(47.6, -122.33), 
  pushpinOptions); 
map.entities.push(pushpin);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top