Ask a questionAsk a question
 

AnswerFilter Pushpins Dynamicllly

  • Saturday, October 31, 2009 1:26 PMBoraD Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I am adding pushpins to the map by using a stored latlong points.  Which works great with Map Server Control. Now I want remove some of the pushping based on filter from the map by using the shape description since I have a key identifier on it.   Basically, if I can get list of all the pushpin ids on the map. I can look into the shape description and remove it from the map if it matches to my createria.  I could not find a method that let me get all the pushpins that were added to the map.  Is there any to get them, or is there any to get the shapelayer and loop through it shapes. 

    Thanks BD

Answers

All Replies

  • Saturday, October 31, 2009 2:11 PMRichard_BrundrittMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    You will want to add all your shapes to a shapelayer. You can then get the number of shapes on a shapelayer using the VEShapeLayer.GetShapeCount() method (http://msdn.microsoft.com/en-us/library/bb429622.aspx ). Once you have this you can loop through from 0 to this number and use the VEShapeLayer.GetShapeByIndex() method to get each shape (http://msdn.microsoft.com/en-us/library/bb412540.aspx ). You can then retrieve the shape id using the EShape.GetID() method (http://msdn.microsoft.com/en-us/library/bb429553.aspx ), or you can use the GetDescription method to retrieve the description for the shape.
    Windows Live Developer MVP - http://rbrundritt.spaces.live.com
  • Saturday, October 31, 2009 5:04 PMBoraD Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I am using the .Net Map Control.  Examples are for JavaScript.   The count comes back as 1, since I added all the pushpins to the layer. But the ShapeLayer comes back as null below.  I guess I was expecting the Shape list of s to be populated with all the push shapes and it is not.

     

     

    ShapeLayer s =Map1.GetShapeLayerByIndex(i); 

    }

    }

    protected void Button3_Click(object sender, EventArgs e) {
    i
    nt y = Map1.GetShapeLayerCount(); for (int i=0; i< y; i++){ Microsoft .Live.ServerControls.VE..ShapeLayer s =Map1.GetShapeLayerByIndex(i);

     

     

    }

    }