Google Distance Matrix API

Is there some component that i can use to access this API?

There are currently no components available that wrap the API, you can however use TMS FNC Core and the TTMSFNCCloudBase to access the stand-alone API. An example:

var
  c: TTMSFNCCloudBase;
begin
  c := TTMSFNCCloudBase.Create;
  c.Request.Host :=
    'https://maps.googleapis.com/maps/api/distancematrix/json' +
    '?destinations=40.659569%2C-73.933783%7C40.729029%2C-73.851524%7C40.6860072%2C-73.6334271%7C40.598566%2C-73.7527626' +
    '&origins=40.6655101%2C-73.89188969999998' +
    '&key=' + MyAPIKey;
  c.ExecuteRequest(
  procedure(const ARequestResult: TTMSFNCCloudBaseRequestResult)
  var 
    r: string;
  begin
    r := ARequestResult.ResultString;
    //parse JSON result
  end
  )

Thank's for the tip, i'll try it

1 Like