Bing Maps API - Deleting Contacts

I have a selection box that allows the user to switch between different lists that fill the bing map with points.

However, when they select another place from the list, I need to delete the old contacts before drawing new ones.

Any ideas, API docs don't seem to cover it?

+4
source share
3 answers

To remove a single button (or any other kind of entity) from the map, you need to call the remove () method on the collection of objects containing the output: http://msdn.microsoft.com/en-us/library/gg427616.aspx . Or, if you want to reference the object by index, use removeAt () instead.

To clear all objects from the collection, call the clear () method.

+4
source

deleteAllShapes () in javascript will do this, now I am working on the same and it is working,

+1
source

Just to clarify the situation. Put it in order for me to figure it out.

Create a pushpin in JavaScipt:

var thisPin; var location new Microsoft.Maps.Location(YourLatitude, Your.longitude); thisPin = new Microsoft.Maps.Pushpin(location, { icon: 'path to image', anchor: new Microsoft.Maps.Point(YourOffsetX, YourOffsetY) }); map.entities.push(thisPin); 

To remove the output, you still need to have thisPin pointer pointing to this particular output.

 map.entities.remove(thisPin); 

This method is not well documented in the examples.

0
source

Source: https://habr.com/ru/post/1394700/


All Articles