marker's id

Topics: Help
Jan 7, 2012 at 6:02 PM

hey everyone :)

can anyone help me on this

i need to locate 4 cars in my map using their id , so everytime the car send latitude and longitude , its marker move to the new location

how to know the id of marker that i have to move

srry for my english

 

Jan 8, 2012 at 4:16 PM

foreach(Marker in overlay.Markers)
{
      if((int)Marker.Tag == id)
      {
            Marker.Position = new PointLatLng(lat, lng);
            break;
      }
}

Sep 25, 2012 at 1:16 PM
Xandolph wrote:

 

foreach(Marker in overlay.Markers)
{
      if((int)Marker.Tag == id)
      {
            Marker.Position = new PointLatLng(lat, lng);
            break;
      }
}

Friends,

Please how can I declare "Marker" shown above ?

I´m using this in the example "Demo.WindowsForms" but is giving me  an error

i tryed to declare as "GMarkerGoogle Marker;"  , GMarker Marker; , ... but without sucess

thanks in advance

Marcelo

 

Sep 25, 2012 at 8:17 PM

I found the error and the correct is below:

      public void UpdatePositionTest(int id, double lat, double lng)
       {
           
           foreach (GMarkerGoogle Marker in objects.Markers)
           {
               if (Marker.Tag != null)
               {
                   if ((int)Marker.Tag == id)
                   {
                       Marker.Position = new PointLatLng(lat, lng);
                       break;
                   }
               }
           }

       }

so now, i can call this with desired "id"  and position ("double lat, double lng") that work fine to move Marker to a new position

regards,

Marcelo

Coordinator
Sep 25, 2012 at 8:25 PM

..anyway if you have many markers, dictionary is the fastest way

Sep 26, 2012 at 10:36 AM

Ok radioman, i agree with you this is not the fastest way

thank you

Marcelo