Jump to content

UniMap - UniMarker update postion


PS1

Recommended Posts

How can i update marker postion on unimap in runtime by code?

I can remove marker and add new one with new coordinates, but it working very slowly. i tried editing UniMap.pas with my function below but it giving me error : "JS Error: Cannot read properties of null (reading 'lat')"

procedure TUniMapMarker.SetLatLng(Lat,Lng:double);
begin
  with FOwner do
    JSCallGlobal(FMarkerJSName+'.setLatLng', [Lat,Lng]);
end;

 

I took it from the documentation : https://leafletjs.com/reference.html#Marker

@Hayri ASLAN

Link to comment
Share on other sites

1 hour ago, PS1 said:

How can i update marker postion on unimap in runtime by code?

I can remove marker and add new one with new coordinates, but it working very slowly. i tried editing UniMap.pas with my function below but it giving me error : "JS Error: Cannot read properties of null (reading 'lat')"

procedure TUniMapMarker.SetLatLng(Lat,Lng:double);
begin
  with FOwner do
    JSCallGlobal(FMarkerJSName+'.setLatLng', [Lat,Lng]);
end;

 

I took it from the documentation : https://leafletjs.com/reference.html#Marker

@Hayri ASLAN

Please use

JSCallGlobal(FMarkerJSName+'.setLatLng', [JSArray([Latitude,Longitude])]);

 

I added SetLatLong procedure to UniMapMarker. With the new build, you will be able to use it as UniMap1.GetMarkerById(1).SetLatLong(Lat,Long)

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...