0

I'm using Bing Maps to show locations of stores. The store information is being populated from a dynamic JSON response. On page load, the map loads local stores with pushpins and infoboxes. When the map pans, I want to keep the pins that are already on the map where they are, and create additional pins of stores within the radius of the map's bounding box, and remove them when they leave the radius (all while keeping the original store pushpins).

Right now, I'm at the point of populating the map, and adding the new pushpins as the map pans. However, I'm kind of lost when it comes to removing the new pins, while maintaining the original ones. From my Google searches, and research, I think I'd want to create two entitiy layers for the pins, and then remove the pins on the second entity layer as the map pans around, while re-populating with new store pins.

Does this make sense? Does anyone have any idea how to create pins on two separate entity layers, and then remove the pins on one of the layers?

Thanks!

Mark Kimitch
  • 322
  • 3
  • 9

1 Answers1

2

You need to add the pushpins in two different EntityCollection (they're like Shape layer), see: http://msdn.microsoft.com/en-us/library/gg427616.aspx

If you added the secondary pushpins in a separate entity collection, then you can call clear() on the specific entity collection to remove the secondary pushpins and add the new ones without removing your main pushpins.

If you need more help, let us know.

Nicolas Boonaert
  • 2,954
  • 1
  • 20
  • 28