Is it possible to calculate the distance on road between two address?
So do you have an exemple with this option?
No different way, just different endpoint: https://developers.google.com/maps/documentation/distance-matrix/start
Thanx that is the solution !
I did it with distancematrix from Google API default is driving mode.
For more information look at :
https://developers.google.com/maps/documentation/distance-matrix/intro#DistanceMatrixRequestsMy Code :
uses fphttpclient,fpjson,jsonparser;
procedure TForm1.FormCreate(Sender: TObject);
var
ReturnValues: TJSONObject;
MyStartAddress, MyDestinationAddress: string;
begin
MyStartAddress:='120+road+cityland+postalcode';
MyDestinationAddress:='2+street+New+York';
//Use Imperial for Miles and Metric form Kilometers units
with TJSONObject(GetJSON(TFPHTTPClient.SimpleGet('https://maps.googleapis.com/maps/api/distancematrix/json?units=metric&origins='+MyStartAddress+'&destinations='+MyDestinationAddress+'&key=XXXXXXXYourGoogleKeyAPI'))) do
try
ReturnValues := TJSONObject(FindPath('rows[0].elements[0].distance'));
showmessage(ReturnValues['text'].AsString);//show the distance default return
finally
Free;
end;
end;
I chat with google support and I can tell you that google cloud is free if you use less than 40 000 requests per month.
Thank you so much !