You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MapQuest is not returning any useful information for coordinates in London. However, because it does include a locations element in the returned JSON, a results array is returned from the provider, with null values for all fields except the given coordinates.
Because a (bad) result is returned, the next provider in my chain is never queried to get the correct data.
Modified the provider to only return results if there are any non-empty values to be written.
The test file I was using to verify the behavior is below:
<?php
require_once dirname(dirname(__FILE__)).'/vendor/autoload.php';
header('Content-type: text/plain');
$geocoder = new \Geocoder\Geocoder();
$buzz = new \Buzz\Browser(new \Buzz\Client\Curl());
$adapter = new \Geocoder\HttpAdapter\BuzzHttpAdapter($buzz);
$chain = new \Geocoder\Provider\ChainProvider(
array(
new \Geocoder\Provider\MapQuestProvider($adapter, 'mapquest_api_key'),
new \Geocoder\Provider\GoogleMapsBusinessProvider($adapter, 'google_client_id', 'google_private_key')
)
);
$geocoder->registerProvider($chain);
$coordinatesArray = array(
array('38.8953003', '-77.0328011'), // Washington, DC
array('48.868865', '2.339355'), // Paris
array('51.507276', '-0.12766') // London
);
foreach ($coordinatesArray as $coordinates) {
$geocoded = $geocoder->reverse($coordinates[0], $coordinates[1]);
echo "reverse geocoding $coordinates[0], $coordinates[1]:\n";
print_r($geocoded);
}
0 commit comments