Closed brianrlewis closed 4 years ago
I'm not sure if this is a bug fix or not, but recently the distancematrix stopped working for me after I upgraded from 1.0.9 to 6.0. When I use it like this:
1.0.9
6.0
$response = GoogleMaps::load('distancematrix') ->setParam([ 'origins' => ['32.80829080,-116.93529140'], 'destinations' => ['32.83598900,-116.86767200'], 'mode' => 'driving', 'units' => 'imperial', 'language' => 'EN' ]) ->getResponseByKey('rows.elements')['rows'][0];
This is the response I get:
{"elements":[{"status":"NOT_FOUND"}]}
The cause appears to be that the joinParam method in Parameters.php is returning the following:
joinParam
Parameters.php
["origins=32.80829080+percent+2C-116.93529140", "destinations=32.83598900+percent+2C-116.86767200", "mode=driving", "language=EN", "units=imperial"]
Adding a str_replace for %2C to the replaceCharacters method fixes the problem.
replaceCharacters
Thanks @brianrlewis !
I'm not sure if this is a bug fix or not, but recently the distancematrix stopped working for me after I upgraded from
1.0.9
to6.0
. When I use it like this:This is the response I get:
{"elements":[{"status":"NOT_FOUND"}]}
The cause appears to be that the
joinParam
method inParameters.php
is returning the following:["origins=32.80829080+percent+2C-116.93529140", "destinations=32.83598900+percent+2C-116.86767200", "mode=driving", "language=EN", "units=imperial"]
Adding a str_replace for %2C to the
replaceCharacters
method fixes the problem.