Hi,
when I try to get a distance between cities (TMSFNCDirections) with accented letters in name, I have no result. The problem is that if I put the “converted” HTML code for the letter (è and similar) I have the same no result. Same for the degree char (°) converted in °
Have you a hint for this?
Thanks in advance.
Thank you! Do you think that in a distant future we can have a sync calculation? Because if I have lot of routes to calculate I get a nice “out of memory” message. If I have a sync route calculation I can create and free the component on the fly… and for now I can’t compile on x64 because I have a problem on Devexpress spreadsheet component, so I have to wait until I change the program to use TMS one.
Possibly the issue is not directly related to accented characters. Please make sure your start and end address are detailed enough for the API to determine the location.
You can check this by using TTMSFNCGeocoding.GetGeocoding, for example simply using "Località" is not returning any results (see screenshot 1), while "Località Crocetta" does (see screenshot 2).
This is then also working as expected when used in TTMSFNCDirections.GetDirections (see screenshot 3).
Great. I will investigate deeper, because if I substitute the accented letters I have the right result.
It is right that “Località” gives you 0 results because here in Italy Località it’s a common way to define a “part” of a city and alone it has no position, but if you use Località Crocetta it’s ok. Maybe the problemi is only on the waypoints. If I have some updated information I will put it on this thread.
Hi, have you also noticed that the GetDirections method is a memory hog?
Is there a way to free resources by request “id”? I have a lot of calculations to do every time…
We are not aware of any memory issues regarding TTMSFNCDirections.
How many times are you calling GetDirections in your application?
Unfortunately there is no built-in function available to remove requests based on ID.
However this is a good suggestion and we'll investigate if this can be added in the future.
Alternatively you can manually loop the DirectionsRequests collection and remove the items you no longer need based on the ID.
I have hundreds of calculations for every date of the month. I think that (with 32bit exe) I can do a - roughly extimated - 1000 calls before the out of memory, so I explain to my users that it’s better to exit the form every 2 cycles of calculation and then restart the procedure. For now it works.
For now I will try the loop for cleaning up things.
With that amount of calls I can see memory could indeed be an issue.
Depending on what your code looks like there might be different approaches possible.
However, here are two straightforward options if you are using the OnGetDirections event to handle the request data: Option A: simply clear request items. This leaves only the empty items in the DirectionsRequests collection which should reduce memory usage significantly. Option B: Loop over the collection items in a separate thread and compare IDs with ARequest.ID to remove the corresponding item.
procedure TForm1.TMSFNCDirections1GetDirections(Sender: TObject;
const ARequest: TTMSFNCDirectionsRequest;
const ARequestResult: TTMSFNCCloudBaseRequestResult);
begin
//Handle ARequest.Items data
//Option A
ARequest.Items.Clear;
//Option B
TThread.Queue(nil, procedure
var
I: Integer;
begin
if not Assigned(TMSFNCDirections1) then
Exit;
for I := TMSFNCDirections1.DirectionsRequests.Count - 1 downto 0 do
if TMSFNCDirections1.DirectionsRequests[I].ID = ARequest.ID then
begin
TMSFNCDirections1.DirectionsRequests[I].Free;
Break;
end;
end);
end;