GPS marker position on movement.

Hello


I'm using TTMSFMXWEBGMaps, and I'm developing a similar Uber software for one client.

When the user use the Application it needs to show the GPS point in the Map, refresh doesn't need to be in real time, It can refresh it after 15-25 seconds.

However I code the application in order to mark the initial position, and with a TTimer (15-25 seconds) delete the initial gps position, and paint the new one using the new gps coordinates return by the sensor.

Next code used when enter the map for the first time

procedure TMapa.MarcadorPosicionGPS();
Var
     Marcador: TMarker;
Begin
     // Eliminamos cualquier marcador del usuario actual
     NavegadorWEB.Markers.Clear;

     // Mostramos el mapa
     Marcador := NavegadorWEB.Markers.Add;
     Marcador.Latitude := 234234;
     Marcador.Longitude := 23423;
     Marcador.Draggable := False;
     Marcador.Icon := 'http://192.168.1.2/PinAzul.png';

     NavegadorWEB.CreateMapMarker(Marcador);
     NavegadorWEB.MapPanTo(23423423423);
End;

How can refresh or move the initial marker point based on the new gps coordinates?

Regards

Hi, 


You will need to remove the marker in the above routine, before adding a new one. There is no refresh method implemented.

Kind Regards, 
Pieter 

Pieter

With a NavegadorWEB.Markers.Clear; will do the trick?

After that should I need to create again the new marker with new positions correct?

If so... can you please give me what method to use in order to refresh or repaint the WebGMap, because sometimes after I clear all the markes control remains with garbage of the old marker.


Thanks

Hi, 


You should use the code with the following change:

procedure TMapa.MarcadorPosicionGPS();
Var
     Marcador: TMarker;
Begin
     // Eliminamos cualquier marcador del usuario actual
     NavegadorWEB.Markers.Clear;
-->     NavegadorWEB.DeleteAllMapMarker;

     // Mostramos el mapa
     Marcador := NavegadorWEB.Markers.Add;
     Marcador.Latitude := 234234;
     Marcador.Longitude := 23423;
     Marcador.Draggable := False;
     Marcador.Icon := 'http://192.168.1.2/PinAzul.png';

     NavegadorWEB.CreateMapMarker(Marcador);
     NavegadorWEB.MapPanTo(23423423423);
End;
Pieter

Once again I need your help, I make one marker update its position based on a gps coordinates. In fact I see the movement in the WebGMap component with the next code:

WebGMap.Markers[0].Latitude := NewLocation.Latitude;
WebGMap.Markers[0].Longitude := NewLocation.Longitude;

The WebGMap first marker created is the one painted on blue in order to represent the actual position of the user, this marker I created using the next code:


Marcador := WebGMap.Markers.Add;
     Marcador.Latitude := ValorLatitud;
     Marcador.Longitude := ValorLongitud;
     Marcador.Draggable := False;
     Marcador.Clickable := False;
     Marcador.Icon := 'http://somewhere.com/bluecircle.png';
     NavegadorWEB.CreateMapMarker(Marcador);

After I created the gps marker above, I create more markers on the WebGMap representing incidents with the next code:

Marcador2 := WebGMap.Markers.Add;
                         Marcador2.Latitude := StrToFloat(LatitudIncidente);
                         Marcador2.Longitude := StrToFloat(LongitudIncidente);
                         Marcador2.Draggable := False;
                         NavegadorWEB.CreateMapMarker(Marcador2);


All the code above works, except that the first marker the gps user position doesn't move it, it moves the next standard red balloon marker of the incidents, I want to move the first marker in the Markers[] array, can you help me please?

Hi,


I have not been able to reproduce this issue.
The sample code you provided looks OK, except that you are using a different name to refer to the TWebGMaps control for the Markers.Add and CreateMapMarker call.

If the problem persists, can you please provide a ready to run sample project that demonstrates the issue so I can further investigate this?
Sample projects can be emailed to: mailto:info@tmssoftware.com

Bart


I want you to download the Google Play Store App in order to review this issue and see for yourself.

I appreciate your suggestion, but we need to be able to view the source code of a sample project that demonstrates the issue in order to find out the cause of the problem.