When I send a large WayPoint array through the GetDirections method, it returns 0 data after a certain count of waypoints.
procedure TForm1.FormCreate(Sender: TObject);
begin
TMSFNCGoogleMaps1.APIKey := API_KEY;
TMSFNCDirections1.APIKey := API_KEY;
TMSFNCDirections1.OnGetDirections := DoGetDirections;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Origin : TTMSFNCMapsCoordinateRec;
Destination : TTMSFNCMapsCoordinateRec;
WayPoints : TTMSFNCMapsCoordinateRecArray;
begin
Origin.Longitude := -110.843326;
Origin.Latitude := 32.2345899;
SetLength(WayPoints, 26);
WayPoints[0].Longitude := -110.843326;
WayPoints[0].Latitude :=32.2345899;
WayPoints[1].Longitude :=-97.7200039;
WayPoints[1].Latitude :=30.2832848;
WayPoints[2].Longitude :=-90.447392;
WayPoints[2].Latitude :=31.287865;
WayPoints[3].Longitude := -83.4180214;
WayPoints[3].Latitude := 33.6609951;
WayPoints[4].Longitude := -83.944795;
WayPoints[4].Latitude := 39.1048254;
WayPoints[5].Longitude := -90.446658;
WayPoints[5].Latitude := 42.8197128;
WayPoints[6].Longitude :=-95.458684;
WayPoints[6].Latitude := 45.835622;
WayPoints[7].Longitude := -95.458684;
WayPoints[7].Latitude := 45.835622;
WayPoints[8].Longitude := -103.7766151;
WayPoints[8].Latitude := 46.9278862;
WayPoints[9].Longitude := -110.8988813;
WayPoints[9].Latitude := 46.7338284;
WayPoints[10].Longitude := -116.4330516;
WayPoints[10].Latitude := 47.6888225;
WayPoints[11].Longitude := -120.6530663;
WayPoints[11].Latitude := 46.5548062;
WayPoints[12].Longitude := -120.303075;
WayPoints[12].Latitude := 43.3791663;
WayPoints[13].Longitude := -118.1925333;
WayPoints[13].Latitude := 40.3112814;
WayPoints[14].Longitude := -115.886726;
WayPoints[14].Latitude := 38.254646;
WayPoints[15].Longitude := -108.1668703;
WayPoints[15].Latitude :=35.5956311;
WayPoints[16].Longitude := -101.756592;
WayPoints[16].Latitude := 33.3509071;
WayPoints[17].Longitude := -95.3382649;
WayPoints[17].Latitude := 33.8648304;
WayPoints[18].Longitude := -89.7154085;
WayPoints[18].Latitude := 36.3136422;
WayPoints[19].Longitude := -92.4441323;
WayPoints[19].Latitude := 41.7012704;
WayPoints[20].Longitude := -99.0831887;
WayPoints[20].Latitude := 44.7374548;
WayPoints[21].Longitude := -100.0831887;
WayPoints[21].Latitude := 45.7374548;
WayPoints[22].Longitude := -101.0831887;
WayPoints[22].Latitude := 46.7374548;
WayPoints[23].Longitude := -102.0831887;
WayPoints[23].Latitude := 47.7374548;
WayPoints[24].Longitude := -103.0831887;
WayPoints[24].Latitude := 48.7374548;
WayPoints[25].Longitude := -104.886726;
WayPoints[25].Latitude := 38.254646;
Destination.Longitude := -111.9163464;
Destination.Latitude := 44.8001963;
TMSFNCDirections1.GetDirections(Origin, Destination, nil, 'FullRoute', nil, False, tmTruck, WayPoints, False, '', mlmDefault, True);
end;
procedure TForm1.DoGetDirections(Sender: TObject;
const ARequest: TTMSFNCDirectionsRequest;
const ARequestResult: TTMSFNCCloudBaseRequestResult);
var
its: TTMSFNCDirectionsItems;
begin
its := ARequest.Items;
showmessage(its.Count.ToString);
end;
If you take the size of the WayPoints array down by 1 it gives the directions properly.
This isn't exactly a real life use case, but I thought I'd see if I can get any info from you guys on this one. Who knows what my users might come up with.