question

DaPaul-8209 avatar image
0 Votes"
DaPaul-8209 asked rbrundritt commented

What happens to my second pushpin? It does not appear on the map. The first one does, but that the only one.

I have tried this demo:

var map = new Microsoft.Maps.Map(document.getElementById('myMap'), {
center: new Microsoft.Maps.Location(47.60995, -122.34009)
});
Microsoft.Maps.loadModule('Microsoft.Maps.WellKnownText', function () {
// Add a Pushpin at Seattle
map.entities.push(Microsoft.Maps.WellKnownText.read('POINT(-122.34009 47.60995)'));
});

Works fine. But if I try to add another PushPin by adding the following lines to the above program, like this:

Microsoft.Maps.loadModule('Microsoft.Maps.WellKnownText', function () {
// Add a Pushpin somewhere
map.entities.push(Microsoft.Maps.WellKnownText.read('POINT(-122.35009 47.61995)'));
});

another PushPin should appear. But it doesn't.

Hope someone can give me some advice, I cannot see why it doesn't work.

Thanks and best regards

PoulK





azure-maps
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

rbrundritt avatar image
0 Votes"
rbrundritt answered rbrundritt commented

A couple of things to look into to.

  1. Try zooming the map in. Those two coordinates are less than a mile apart, which means at around zoom level 7 the two coordinates would be rendered in the exact same pixel location and overlapping. When you zoom in closer the pin icons would likely still overlap a bit, until you are zoomed in to about city level.

  2. Generally you only need to load a module once. Loading the module repeatedly just complicates the code and adds more code for you to debug.

  3. Make sure you don't have any other code that runs that clears the map between these two calls. Note that loading a module is asynchronous, so a clear method could be called further down in your code but be processed before the module load callback is called.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi rbrundritt

I hought I'd send you an answer yesteday, but I must have fumbled, so here goes.

1) I know about the zoom.
2) Aha. Good to know.
3) I actually do not clear my map at any time. Not knowingly any way. But I'll look into it.

I checked the problem some more, and it seems that what actually happens is that my mouse stops working. Weird. But instead I can press the spacebar and get the same reaction as for a mouseclick.

I can send you my sourcecode if you'd like.

Thanks and best regards

PoulK

0 Votes 0 ·

Feel free to send me your source code to richbrun at microsoft dot com

0 Votes 0 ·