none
How check is Pushpin on entitycollection with json query RRS feed

  • Question

  • Hello,

    I create pushpin command

    var pushpinOptions = {icon: iconpath, text : icontext, typeName: stylename, textOffset: offset}; var loc = new Microsoft.Maps.Location(lat, lon); deviceid = new Microsoft.Maps.Pushpin(loc, pushpinOptions);

    PinsLayer.push(deviceid);

    Then I make JSON query and background and query return "deviceid" on string format and I try check is this deviceid created on PinsLayer entitycollection.

    It is possibly make this somehow? My main idea  is get pins new position on database and move pins if needed. I have to check if pin is created and is pin on entitycollection.

    Wednesday, September 12, 2012 11:46 AM

Answers

  • Not 100% sure if I understood your question but I'll try and give you an answer. I assume you want to assign your pushpin an ID and then later be able to use this ID to retrieve the pushpin object. This can be easily done. In JavaScript you can add properties object simply by defining them. So you can do this to add an ID to your pushpin:

    var pin = new Microsoft.Maps.Pushpin(loc);

    pin.MyID = "SomeIDValue";

    You can then later loop through all the entities in your PinsLayer and check to see if they have a MyID property and if they do does it make the value you are looking for.


    http://rbrundritt.wordpress.com

    • Proposed as answer by Ricky_Brundritt Wednesday, September 12, 2012 6:57 PM
    • Marked as answer by Henri Karhunen Thursday, September 13, 2012 3:03 AM
    Wednesday, September 12, 2012 6:57 PM

All replies

  • Not 100% sure if I understood your question but I'll try and give you an answer. I assume you want to assign your pushpin an ID and then later be able to use this ID to retrieve the pushpin object. This can be easily done. In JavaScript you can add properties object simply by defining them. So you can do this to add an ID to your pushpin:

    var pin = new Microsoft.Maps.Pushpin(loc);

    pin.MyID = "SomeIDValue";

    You can then later loop through all the entities in your PinsLayer and check to see if they have a MyID property and if they do does it make the value you are looking for.


    http://rbrundritt.wordpress.com

    • Proposed as answer by Ricky_Brundritt Wednesday, September 12, 2012 6:57 PM
    • Marked as answer by Henri Karhunen Thursday, September 13, 2012 3:03 AM
    Wednesday, September 12, 2012 6:57 PM
  • Hello. You understand just right and I found here forum one post where is same idea and I got this working. Thanks.
    Thursday, September 13, 2012 3:02 AM