Closed juragandotid closed 6 years ago
Sure. Have a look at our dumpers: https://github.com/geocoder-php/Geocoder#dumpers
require_once('vendor/autoload.php');
use Geocoder\Query\GeocodeQuery;
use Geocoder\Query\ReverseQuery;
$httpClient = new \Http\Adapter\Guzzle6\Client();
$provider = new \Geocoder\Provider\GoogleMaps\GoogleMaps($httpClient);
$geocoder = new \Geocoder\StatefulGeocoder($provider, 'en');
$result = $geocoder->reverseQuery(ReverseQuery::fromCoordinates('43.0481','-76.1474'));
$dumper = new \Geocoder\Dumper\Gpx();
$strGpx = $dumper->dump($result);
echo $strGpx;
igot an error :
'PHP Fatal error: Uncaught TypeError: Argument 1 passed to Geocoder\Dumper\Gpx::dump() must implement interface Geocoder\Location, instance of Geocoder\Model\AddressCollection given, called in F:\geocoder\tester.php on line 15 and defined in F:\geocoder\vendor\willdurand\geocoder\Dumper\Gpx.php:28
Stack trace:
#0 F:\geocoder\tester.php(15): Geocoder\Dumper\Gpx->dump(Object(Geocoder\Model\AddressCollection))
#1 {main}
thrown in F:\geocoder\vendor\willdurand\geocoder\Dumper\Gpx.php on line 28
Fatal error: Uncaught TypeError: Argument 1 passed to Geocoder\Dumper\Gpx::dump() must implement interface Geocoder\Location, instance of Geocoder\Model\AddressCollection given, called in F:\geocoder\tester.php on line 15 and defined in F:\geocoder\vendor\willdurand\geocoder\Dumper\Gpx.php:28
Stack trace:
#0 F:\geocoder\tester.php(15): Geocoder\Dumper\Gpx->dump(Object(Geocoder\Model\AddressCollection))
#1 {main}
thrown in F:\geocoder\vendor\willdurand\geocoder\Dumper\Gpx.php on line 28'
Could you please use words instead of non formatted code?
this is my script :
require_once('vendor/autoload.php');
use Geocoder\Query\GeocodeQuery;
use Geocoder\Query\ReverseQuery;
$httpClient = new \Http\Adapter\Guzzle6\Client();
$provider = new \Geocoder\Provider\GoogleMaps\GoogleMaps($httpClient);
$geocoder = new \Geocoder\StatefulGeocoder($provider, 'en');
$result = $geocoder->reverseQuery(ReverseQuery::fromCoordinates('43.0481','-76.1474'));
$coba = var_dump($result);
$dumper = new \Geocoder\Dumper\Gpx();
$strGpx = $dumper->dump($coba);
echo $strGpx;
i got this response
object(Geocoder\Model\AddressCollection)#162 (1) {
["locations":"Geocoder\Model\AddressCollection":private]=>
array(5) {
[0]=>
object(Geocoder\Provider\GoogleMaps\Model\GoogleAddress)#128 (29) {
["id":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
string(94) "EiczNDkgUyBTdGF0ZSBTdCwgU3lyYWN1c2UsIE5ZIDEzMjAyLCBVU0EiGxIZChQKEgmX5rq9u_PZiRHTH3j5h04aXxDdAg"
["locationType":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
string(18) "RANGE_INTERPOLATED"
["resultType":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
array(1) {
[0]=>
string(14) "street_address"
}
["formattedAddress":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
string(39) "349 S State St, Syracuse, NY 13202, USA"
["streetAddress":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["intersection":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["political":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
string(13) "United States"
["colloquialArea":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["ward":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["neighborhood":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
string(8) "Downtown"
["premise":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["subpremise":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["naturalFeature":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["airport":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["park":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["pointOfInterest":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["establishment":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["subLocalityLevels":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
object(Geocoder\Model\AdminLevelCollection)#131 (1) {
["adminLevels":"Geocoder\Model\AdminLevelCollection":private]=>
array(0) {
}
}
["coordinates":"Geocoder\Model\Address":private]=>
object(Geocoder\Model\Coordinates)#123 (2) {
["latitude":"Geocoder\Model\Coordinates":private]=>
float(43.0483083)
["longitude":"Geocoder\Model\Coordinates":private]=>
float(-76.1474409)
}
["bounds":"Geocoder\Model\Address":private]=>
object(Geocoder\Model\Bounds)#124 (4) {
["south":"Geocoder\Model\Bounds":private]=>
float(43.046959319708)
["west":"Geocoder\Model\Bounds":private]=>
float(-76.148789880292)
["north":"Geocoder\Model\Bounds":private]=>
float(43.049657280291)
["east":"Geocoder\Model\Bounds":private]=>
float(-76.146091919708)
}
["streetNumber":"Geocoder\Model\Address":private]=>
string(3) "349"
["streetName":"Geocoder\Model\Address":private]=>
string(18) "South State Street"
["subLocality":"Geocoder\Model\Address":private]=>
NULL
["locality":"Geocoder\Model\Address":private]=>
string(8) "Syracuse"
["postalCode":"Geocoder\Model\Address":private]=>
string(5) "13202"
["adminLevels":"Geocoder\Model\Address":private]=>
object(Geocoder\Model\AdminLevelCollection)#129 (1) {
["adminLevels":"Geocoder\Model\AdminLevelCollection":private]=>
array(2) {
[1]=>
object(Geocoder\Model\AdminLevel)#126 (3) {
["level":"Geocoder\Model\AdminLevel":private]=>
int(1)
["name":"Geocoder\Model\AdminLevel":private]=>
string(8) "New York"
["code":"Geocoder\Model\AdminLevel":private]=>
string(2) "NY"
}
[2]=>
object(Geocoder\Model\AdminLevel)#125 (3) {
["level":"Geocoder\Model\AdminLevel":private]=>
int(2)
["name":"Geocoder\Model\AdminLevel":private]=>
string(15) "Onondaga County"
["code":"Geocoder\Model\AdminLevel":private]=>
string(15) "Onondaga County"
}
}
}
["country":"Geocoder\Model\Address":private]=>
object(Geocoder\Model\Country)#127 (2) {
["name":"Geocoder\Model\Country":private]=>
string(13) "United States"
["code":"Geocoder\Model\Country":private]=>
string(2) "US"
}
["timezone":"Geocoder\Model\Address":private]=>
NULL
["providedBy":"Geocoder\Model\Address":private]=>
string(11) "google_maps"
}
[1]=>
object(Geocoder\Provider\GoogleMaps\Model\GoogleAddress)#136 (29) {
["id":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
string(27) "ChIJx0Y8Qbnz2YkRrGVC7MdYpzo"
["locationType":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
string(11) "APPROXIMATE"
["resultType":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
array(2) {
[0]=>
string(12) "neighborhood"
[1]=>
string(9) "political"
}
["formattedAddress":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
string(27) "Downtown, Syracuse, NY, USA"
["streetAddress":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["intersection":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["political":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
string(13) "United States"
["colloquialArea":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["ward":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["neighborhood":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
string(8) "Downtown"
["premise":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["subpremise":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["naturalFeature":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["airport":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["park":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["pointOfInterest":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["establishment":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["subLocalityLevels":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
object(Geocoder\Model\AdminLevelCollection)#139 (1) {
["adminLevels":"Geocoder\Model\AdminLevelCollection":private]=>
array(0) {
}
}
["coordinates":"Geocoder\Model\Address":private]=>
object(Geocoder\Model\Coordinates)#122 (2) {
["latitude":"Geocoder\Model\Coordinates":private]=>
float(43.0484643)
["longitude":"Geocoder\Model\Coordinates":private]=>
float(-76.1508385)
}
["bounds":"Geocoder\Model\Address":private]=>
object(Geocoder\Model\Bounds)#132 (4) {
["south":"Geocoder\Model\Bounds":private]=>
float(43.042166)
["west":"Geocoder\Model\Bounds":private]=>
float(-76.1583461)
["north":"Geocoder\Model\Bounds":private]=>
float(43.054231)
["east":"Geocoder\Model\Bounds":private]=>
float(-76.1428463)
}
["streetNumber":"Geocoder\Model\Address":private]=>
NULL
["streetName":"Geocoder\Model\Address":private]=>
NULL
["subLocality":"Geocoder\Model\Address":private]=>
NULL
["locality":"Geocoder\Model\Address":private]=>
string(8) "Syracuse"
["postalCode":"Geocoder\Model\Address":private]=>
NULL
["adminLevels":"Geocoder\Model\Address":private]=>
object(Geocoder\Model\AdminLevelCollection)#137 (1) {
["adminLevels":"Geocoder\Model\AdminLevelCollection":private]=>
array(2) {
[1]=>
object(Geocoder\Model\AdminLevel)#134 (3) {
["level":"Geocoder\Model\AdminLevel":private]=>
int(1)
["name":"Geocoder\Model\AdminLevel":private]=>
string(8) "New York"
["code":"Geocoder\Model\AdminLevel":private]=>
string(2) "NY"
}
[2]=>
object(Geocoder\Model\AdminLevel)#133 (3) {
["level":"Geocoder\Model\AdminLevel":private]=>
int(2)
["name":"Geocoder\Model\AdminLevel":private]=>
string(15) "Onondaga County"
["code":"Geocoder\Model\AdminLevel":private]=>
string(15) "Onondaga County"
}
}
}
["country":"Geocoder\Model\Address":private]=>
object(Geocoder\Model\Country)#135 (2) {
["name":"Geocoder\Model\Country":private]=>
string(13) "United States"
["code":"Geocoder\Model\Country":private]=>
string(2) "US"
}
["timezone":"Geocoder\Model\Address":private]=>
NULL
["providedBy":"Geocoder\Model\Address":private]=>
string(11) "google_maps"
}
[2]=>
object(Geocoder\Provider\GoogleMaps\Model\GoogleAddress)#144 (29) {
["id":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
string(27) "ChIJDZqXv5vz2YkRRZWt1-IM1QA"
["locationType":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
string(11) "APPROXIMATE"
["resultType":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
array(2) {
[0]=>
string(8) "locality"
[1]=>
string(9) "political"
}
["formattedAddress":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
string(17) "Syracuse, NY, USA"
["streetAddress":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["intersection":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["political":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
string(13) "United States"
["colloquialArea":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["ward":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["neighborhood":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["premise":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["subpremise":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["naturalFeature":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["airport":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["park":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["pointOfInterest":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["establishment":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["subLocalityLevels":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
object(Geocoder\Model\AdminLevelCollection)#147 (1) {
["adminLevels":"Geocoder\Model\AdminLevelCollection":private]=>
array(0) {
}
}
["coordinates":"Geocoder\Model\Address":private]=>
object(Geocoder\Model\Coordinates)#130 (2) {
["latitude":"Geocoder\Model\Coordinates":private]=>
float(43.0481221)
["longitude":"Geocoder\Model\Coordinates":private]=>
float(-76.1474244)
}
["bounds":"Geocoder\Model\Address":private]=>
object(Geocoder\Model\Bounds)#140 (4) {
["south":"Geocoder\Model\Bounds":private]=>
float(42.984366)
["west":"Geocoder\Model\Bounds":private]=>
float(-76.204476)
["north":"Geocoder\Model\Bounds":private]=>
float(43.0861018)
["east":"Geocoder\Model\Bounds":private]=>
float(-76.0740841)
}
["streetNumber":"Geocoder\Model\Address":private]=>
NULL
["streetName":"Geocoder\Model\Address":private]=>
NULL
["subLocality":"Geocoder\Model\Address":private]=>
NULL
["locality":"Geocoder\Model\Address":private]=>
string(8) "Syracuse"
["postalCode":"Geocoder\Model\Address":private]=>
NULL
["adminLevels":"Geocoder\Model\Address":private]=>
object(Geocoder\Model\AdminLevelCollection)#145 (1) {
["adminLevels":"Geocoder\Model\AdminLevelCollection":private]=>
array(2) {
[1]=>
object(Geocoder\Model\AdminLevel)#142 (3) {
["level":"Geocoder\Model\AdminLevel":private]=>
int(1)
["name":"Geocoder\Model\AdminLevel":private]=>
string(8) "New York"
["code":"Geocoder\Model\AdminLevel":private]=>
string(2) "NY"
}
[2]=>
object(Geocoder\Model\AdminLevel)#141 (3) {
["level":"Geocoder\Model\AdminLevel":private]=>
int(2)
["name":"Geocoder\Model\AdminLevel":private]=>
string(15) "Onondaga County"
["code":"Geocoder\Model\AdminLevel":private]=>
string(15) "Onondaga County"
}
}
}
["country":"Geocoder\Model\Address":private]=>
object(Geocoder\Model\Country)#143 (2) {
["name":"Geocoder\Model\Country":private]=>
string(13) "United States"
["code":"Geocoder\Model\Country":private]=>
string(2) "US"
}
["timezone":"Geocoder\Model\Address":private]=>
NULL
["providedBy":"Geocoder\Model\Address":private]=>
string(11) "google_maps"
}
[3]=>
object(Geocoder\Provider\GoogleMaps\Model\GoogleAddress)#152 (29) {
["id":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
string(27) "ChIJXX3gEb7z2YkRrJj_0-rmXOQ"
["locationType":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
string(11) "APPROXIMATE"
["resultType":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
array(1) {
[0]=>
string(11) "postal_code"
}
["formattedAddress":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
string(23) "Syracuse, NY 13202, USA"
["streetAddress":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["intersection":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["political":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
string(13) "United States"
["colloquialArea":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["ward":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["neighborhood":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["premise":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["subpremise":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["naturalFeature":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["airport":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["park":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["pointOfInterest":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["establishment":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["subLocalityLevels":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
object(Geocoder\Model\AdminLevelCollection)#155 (1) {
["adminLevels":"Geocoder\Model\AdminLevelCollection":private]=>
array(0) {
}
}
["coordinates":"Geocoder\Model\Address":private]=>
object(Geocoder\Model\Coordinates)#138 (2) {
["latitude":"Geocoder\Model\Coordinates":private]=>
float(43.0481645)
["longitude":"Geocoder\Model\Coordinates":private]=>
float(-76.1473156)
}
["bounds":"Geocoder\Model\Address":private]=>
object(Geocoder\Model\Bounds)#148 (4) {
["south":"Geocoder\Model\Bounds":private]=>
float(43.030467)
["west":"Geocoder\Model\Bounds":private]=>
float(-76.163988)
["north":"Geocoder\Model\Bounds":private]=>
float(43.0564569)
["east":"Geocoder\Model\Bounds":private]=>
float(-76.1420219)
}
["streetNumber":"Geocoder\Model\Address":private]=>
NULL
["streetName":"Geocoder\Model\Address":private]=>
NULL
["subLocality":"Geocoder\Model\Address":private]=>
NULL
["locality":"Geocoder\Model\Address":private]=>
string(8) "Syracuse"
["postalCode":"Geocoder\Model\Address":private]=>
string(5) "13202"
["adminLevels":"Geocoder\Model\Address":private]=>
object(Geocoder\Model\AdminLevelCollection)#153 (1) {
["adminLevels":"Geocoder\Model\AdminLevelCollection":private]=>
array(2) {
[1]=>
object(Geocoder\Model\AdminLevel)#150 (3) {
["level":"Geocoder\Model\AdminLevel":private]=>
int(1)
["name":"Geocoder\Model\AdminLevel":private]=>
string(8) "New York"
["code":"Geocoder\Model\AdminLevel":private]=>
string(2) "NY"
}
[2]=>
object(Geocoder\Model\AdminLevel)#149 (3) {
["level":"Geocoder\Model\AdminLevel":private]=>
int(2)
["name":"Geocoder\Model\AdminLevel":private]=>
string(15) "Onondaga County"
["code":"Geocoder\Model\AdminLevel":private]=>
string(15) "Onondaga County"
}
}
}
["country":"Geocoder\Model\Address":private]=>
object(Geocoder\Model\Country)#151 (2) {
["name":"Geocoder\Model\Country":private]=>
string(13) "United States"
["code":"Geocoder\Model\Country":private]=>
string(2) "US"
}
["timezone":"Geocoder\Model\Address":private]=>
NULL
["providedBy":"Geocoder\Model\Address":private]=>
string(11) "google_maps"
}
[4]=>
object(Geocoder\Provider\GoogleMaps\Model\GoogleAddress)#160 (29) {
["id":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
string(27) "ChIJNf-jRf702YkRWbJ48qyiSrI"
["locationType":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
string(11) "APPROXIMATE"
["resultType":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
array(2) {
[0]=>
string(27) "administrative_area_level_2"
[1]=>
string(9) "political"
}
["formattedAddress":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
string(24) "Onondaga County, NY, USA"
["streetAddress":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["intersection":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["political":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
string(13) "United States"
["colloquialArea":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["ward":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["neighborhood":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["premise":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["subpremise":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["naturalFeature":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["airport":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["park":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["pointOfInterest":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["establishment":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
NULL
["subLocalityLevels":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=>
object(Geocoder\Model\AdminLevelCollection)#163 (1) {
["adminLevels":"Geocoder\Model\AdminLevelCollection":private]=>
array(0) {
}
}
["coordinates":"Geocoder\Model\Address":private]=>
object(Geocoder\Model\Coordinates)#146 (2) {
["latitude":"Geocoder\Model\Coordinates":private]=>
float(43.026819)
["longitude":"Geocoder\Model\Coordinates":private]=>
float(-76.1783739)
}
["bounds":"Geocoder\Model\Address":private]=>
object(Geocoder\Model\Bounds)#156 (4) {
["south":"Geocoder\Model\Bounds":private]=>
float(42.7712569)
["west":"Geocoder\Model\Bounds":private]=>
float(-76.499324)
["north":"Geocoder\Model\Bounds":private]=>
float(43.271605)
["east":"Geocoder\Model\Bounds":private]=>
float(-75.8960789)
}
["streetNumber":"Geocoder\Model\Address":private]=>
NULL
["streetName":"Geocoder\Model\Address":private]=>
NULL
["subLocality":"Geocoder\Model\Address":private]=>
NULL
["locality":"Geocoder\Model\Address":private]=>
NULL
["postalCode":"Geocoder\Model\Address":private]=>
NULL
["adminLevels":"Geocoder\Model\Address":private]=>
object(Geocoder\Model\AdminLevelCollection)#161 (1) {
["adminLevels":"Geocoder\Model\AdminLevelCollection":private]=>
array(2) {
[1]=>
object(Geocoder\Model\AdminLevel)#158 (3) {
["level":"Geocoder\Model\AdminLevel":private]=>
int(1)
["name":"Geocoder\Model\AdminLevel":private]=>
string(8) "New York"
["code":"Geocoder\Model\AdminLevel":private]=>
string(2) "NY"
}
[2]=>
object(Geocoder\Model\AdminLevel)#157 (3) {
["level":"Geocoder\Model\AdminLevel":private]=>
int(2)
["name":"Geocoder\Model\AdminLevel":private]=>
string(15) "Onondaga County"
["code":"Geocoder\Model\AdminLevel":private]=>
string(15) "Onondaga County"
}
}
}
["country":"Geocoder\Model\Address":private]=>
object(Geocoder\Model\Country)#159 (2) {
["name":"Geocoder\Model\Country":private]=>
string(13) "United States"
["code":"Geocoder\Model\Country":private]=>
string(2) "US"
}
["timezone":"Geocoder\Model\Address":private]=>
NULL
["providedBy":"Geocoder\Model\Address":private]=>
string(11) "google_maps"
}
}
}
PHP Fatal error: Uncaught TypeError: Argument 1 passed to Geocoder\Dumper\Gpx::dump() must implement interface Geocoder\Location, null given, called in F:\geocoder\tester.php on line 17 and defined in F:\geocoder\vendor\willdurand\geocoder\Dumper\Gpx.php:28
Stack trace:
#0 F:\geocoder\tester.php(17): Geocoder\Dumper\Gpx->dump(NULL)
#1 {main}
thrown in F:\geocoder\vendor\willdurand\geocoder\Dumper\Gpx.php on line 28
Fatal error: Uncaught TypeError: Argument 1 passed to Geocoder\Dumper\Gpx::dump() must implement interface Geocoder\Location, null given, called in F:\geocoder\tester.php on line 17 and defined in F:\geocoder\vendor\willdurand\geocoder\Dumper\Gpx.php:28
Stack trace:
#0 F:\geocoder\tester.php(17): Geocoder\Dumper\Gpx->dump(NULL)
#1 {main}
thrown in F:\geocoder\vendor\willdurand\geocoder\Dumper\Gpx.php on line 28`
any solution ? give me an example pleasse.
Thank you.
Hello @juragandotid ,
First of all, could you have a look at "Mastering Markdown" guide to display pieces of code the right way ? Then please do not copy paste such a huge amount of code, it's useless. Try to only copy-paste the useful information.
I'll have a look at your issue.
@jbelien i wanna parse this response
using dumper ["formattedAddress":"Geocoder\Provider\GoogleMaps\Model\GoogleAddress":private]=> string(23) "Syracuse, NY 13202, USA"
could you give me example please..
Thank you.
As you can see in the error message Argument 1 passed to Geocoder\Dumper\Gpx::dump() must implement interface Geocoder\Location, null given, you have to send a Location to Gpx::dump()
function.
In your example, you send a reverseQuery()
result (and on top of that, the result is apparently null
in your case).
So, you have to go through every result (or use $results->first()
to have the first result) and send that to Gpx::dump()
!
`Geocoder\Model\AddressCollection Object ( [locations:Geocoder\Model\AddressCollection:private] => Array ( [0] => Geocoder\Provider\GoogleMaps\Model\GoogleAddress Object ( [id:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => EiczNDkgUyBTdGF0ZSBTdCwgU3lyYWN1c2UsIE5ZIDEzMjAyLCBVU0EiGxIZChQKEgmX5rq9u_PZiRHTH3j5h04aXxDdAg [locationType:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => RANGE_INTERPOLATED [resultType:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => Array ( [0] => street_address )
)`