none
Hide/Show pushpin RRS feed

  • Question

  • Hi,

    Is it possible to hide/show individual pushpin from EntityCollection. Today we have requirement to hide/show pushpin based on some condition. I was able to hide/show maplyer but i want to hide/show individual pushpin. Is there any way to achieve this.

    Waiting reply.

    Thanks!

    Balasaheb 

    Friday, February 5, 2016 8:46 AM

Answers

  • As I said before, pushpins can be hidden/shown the same way: pin.setOptions({ visible: false });

    If you want to hide pushpins based on a custom property, add a custom property to the pushpin and then loop through all the pushpins in the entity collection an hide those that match your requirement. For example you can add a property called metadata to a pushpin like this:

    pin.metadata = "Your value";


    http://rbrundritt.wordpress.com

    Monday, February 8, 2016 7:52 PM

All replies

  • Set the pushpins visible option to false: https://msdn.microsoft.com/en-us/library/gg427629.aspx

    http://rbrundritt.wordpress.com

    Friday, February 5, 2016 4:00 PM
  • Hi,

    Thanks for your reply. I was able to hide/show whole pushpin EntityCollection. But i want to hide/show specific pushpin from EntityCollection.

    We have used following code to plot the pushpin.

    var  pushpinColl = new Microsoft.Maps.EntityCollection();

      var pushpinOptions = { icon: 'images/searchnearby.png' };

      //add pushpin
       var  pin = new Microsoft.Maps.Pushpin(result.location, pushpinOptions);

     pushpinColl .push(pin);

    Below is the code we used to hide/show all plotted pushpin.

      pushpinColl.setOptions({ visible: false }); 

    Can you please give us the code that only hide/show individual pushpin.

    Waiting for your reply.

    Thanks!

    Balasaheb

    Monday, February 8, 2016 12:54 PM
  • As I said before, pushpins can be hidden/shown the same way: pin.setOptions({ visible: false });

    If you want to hide pushpins based on a custom property, add a custom property to the pushpin and then loop through all the pushpins in the entity collection an hide those that match your requirement. For example you can add a property called metadata to a pushpin like this:

    pin.metadata = "Your value";


    http://rbrundritt.wordpress.com

    Monday, February 8, 2016 7:52 PM
  • Hi Ricky,

    Thanks it is working.

    Appreciate your help!

    Thanks!

    Balasaheb

    Tuesday, February 9, 2016 9:21 AM