geocoder-php / Geocoder

The most featured Geocoder library written in PHP.
https://geocoder-php.org
MIT License
3.95k stars 519 forks source link

Can i parser respon from google maps provider to json? #861

Closed juragandotid closed 6 years ago

juragandotid commented 6 years ago

`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 )

                [formattedAddress:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => 349 S State St, Syracuse, NY 13202, USA
                [streetAddress:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [intersection:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [political:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => United States
                [colloquialArea:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => 
                [ward:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [neighborhood:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => Downtown
                [premise:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [subpremise:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [naturalFeature:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => 
                [airport:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [park:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [pointOfInterest:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [establishment:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [subLocalityLevels:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => Geocoder\Model\AdminLevelCollection Object
                    (
                        [adminLevels:Geocoder\Model\AdminLevelCollection:private] => Array
                            (
                            )

                    )

                [coordinates:Geocoder\Model\Address:private] => Geocoder\Model\Coordinates Object
                    (
                        [latitude:Geocoder\Model\Coordinates:private] => 43.0483083
                        [longitude:Geocoder\Model\Coordinates:private] => -76.1474409
                    )

                [bounds:Geocoder\Model\Address:private] => Geocoder\Model\Bounds Object
                    (
                        [south:Geocoder\Model\Bounds:private] => 43.046959319708
                        [west:Geocoder\Model\Bounds:private] => -76.148789880292
                        [north:Geocoder\Model\Bounds:private] => 43.049657280291
                        [east:Geocoder\Model\Bounds:private] => -76.146091919708
                    )

                [streetNumber:Geocoder\Model\Address:private] => 349
                [streetName:Geocoder\Model\Address:private] => South State Street
                [subLocality:Geocoder\Model\Address:private] =>
                [locality:Geocoder\Model\Address:private] => Syracuse
                [postalCode:Geocoder\Model\Address:private] => 13202
                [adminLevels:Geocoder\Model\Address:private] => Geocoder\Model\AdminLevelCollection Object
                    (
                        [adminLevels:Geocoder\Model\AdminLevelCollection:private] => Array
                            (
                                [1] => Geocoder\Model\AdminLevel Object
                                    (
                                        [level:Geocoder\Model\AdminLevel:private] => 1
                                        [name:Geocoder\Model\AdminLevel:private] => New York
                                        [code:Geocoder\Model\AdminLevel:private] => NY
                                    )

                                [2] => Geocoder\Model\AdminLevel Object
                                    (
                                        [level:Geocoder\Model\AdminLevel:private] => 2
                                        [name:Geocoder\Model\AdminLevel:private] => Onondaga County
                                        [code:Geocoder\Model\AdminLevel:private] => Onondaga County
                                    )

                            )

                    )

                [country:Geocoder\Model\Address:private] => Geocoder\Model\Country Object
                    (
                        [name:Geocoder\Model\Country:private] => United States
                        [code:Geocoder\Model\Country:private] => US
                    )

                [timezone:Geocoder\Model\Address:private] =>
                [providedBy:Geocoder\Model\Address:private] => google_maps
            )

        [1] => Geocoder\Provider\GoogleMaps\Model\GoogleAddress Object
            (
                [id:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => ChIJx0Y8Qbnz2YkRrGVC7MdYpzo
                [locationType:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => APPROXIMATE
                [resultType:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => Array
                    (
                        [0] => neighborhood
                        [1] => political
                    )

                [formattedAddress:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => Downtown, Syracuse, NY, USA
                [streetAddress:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [intersection:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [political:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => United States
                [colloquialArea:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => 
                [ward:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [neighborhood:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => Downtown
                [premise:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [subpremise:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [naturalFeature:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => 
                [airport:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [park:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [pointOfInterest:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [establishment:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [subLocalityLevels:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => Geocoder\Model\AdminLevelCollection Object
                    (
                        [adminLevels:Geocoder\Model\AdminLevelCollection:private] => Array
                            (
                            )

                    )

                [coordinates:Geocoder\Model\Address:private] => Geocoder\Model\Coordinates Object
                    (
                        [latitude:Geocoder\Model\Coordinates:private] => 43.0484643
                        [longitude:Geocoder\Model\Coordinates:private] => -76.1508385
                    )

                [bounds:Geocoder\Model\Address:private] => Geocoder\Model\Bounds Object
                    (
                        [south:Geocoder\Model\Bounds:private] => 43.042166
                        [west:Geocoder\Model\Bounds:private] => -76.1583461
                        [north:Geocoder\Model\Bounds:private] => 43.054231
                        [east:Geocoder\Model\Bounds:private] => -76.1428463
                    )

                [streetNumber:Geocoder\Model\Address:private] =>
                [streetName:Geocoder\Model\Address:private] =>
                [subLocality:Geocoder\Model\Address:private] =>
                [locality:Geocoder\Model\Address:private] => Syracuse
                [postalCode:Geocoder\Model\Address:private] =>
                [adminLevels:Geocoder\Model\Address:private] => Geocoder\Model\AdminLevelCollection Object
                    (
                        [adminLevels:Geocoder\Model\AdminLevelCollection:private] => Array
                            (
                                [1] => Geocoder\Model\AdminLevel Object
                                    (
                                        [level:Geocoder\Model\AdminLevel:private] => 1
                                        [name:Geocoder\Model\AdminLevel:private] => New York
                                        [code:Geocoder\Model\AdminLevel:private] => NY
                                    )

                                [2] => Geocoder\Model\AdminLevel Object
                                    (
                                        [level:Geocoder\Model\AdminLevel:private] => 2
                                        [name:Geocoder\Model\AdminLevel:private] => Onondaga County
                                        [code:Geocoder\Model\AdminLevel:private] => Onondaga County
                                    )

                            )

                    )

                [country:Geocoder\Model\Address:private] => Geocoder\Model\Country Object
                    (
                        [name:Geocoder\Model\Country:private] => United States
                        [code:Geocoder\Model\Country:private] => US
                    )

                [timezone:Geocoder\Model\Address:private] =>
                [providedBy:Geocoder\Model\Address:private] => google_maps
            )

        [2] => Geocoder\Provider\GoogleMaps\Model\GoogleAddress Object
            (
                [id:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => ChIJDZqXv5vz2YkRRZWt1-IM1QA
                [locationType:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => APPROXIMATE
                [resultType:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => Array
                    (
                        [0] => locality
                        [1] => political
                    )

                [formattedAddress:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => Syracuse, NY, USA
                [streetAddress:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [intersection:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [political:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => United States
                [colloquialArea:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => 
                [ward:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [neighborhood:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [premise:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [subpremise:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [naturalFeature:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => 
                [airport:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [park:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [pointOfInterest:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [establishment:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [subLocalityLevels:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => Geocoder\Model\AdminLevelCollection Object
                    (
                        [adminLevels:Geocoder\Model\AdminLevelCollection:private] => Array
                            (
                            )

                    )

                [coordinates:Geocoder\Model\Address:private] => Geocoder\Model\Coordinates Object
                    (
                        [latitude:Geocoder\Model\Coordinates:private] => 43.0481221
                        [longitude:Geocoder\Model\Coordinates:private] => -76.1474244
                    )

                [bounds:Geocoder\Model\Address:private] => Geocoder\Model\Bounds Object
                    (
                        [south:Geocoder\Model\Bounds:private] => 42.984366
                        [west:Geocoder\Model\Bounds:private] => -76.204476
                        [north:Geocoder\Model\Bounds:private] => 43.0861018
                        [east:Geocoder\Model\Bounds:private] => -76.0740841
                    )

                [streetNumber:Geocoder\Model\Address:private] =>
                [streetName:Geocoder\Model\Address:private] =>
                [subLocality:Geocoder\Model\Address:private] =>
                [locality:Geocoder\Model\Address:private] => Syracuse
                [postalCode:Geocoder\Model\Address:private] =>
                [adminLevels:Geocoder\Model\Address:private] => Geocoder\Model\AdminLevelCollection Object
                    (
                        [adminLevels:Geocoder\Model\AdminLevelCollection:private] => Array
                            (
                                [1] => Geocoder\Model\AdminLevel Object
                                    (
                                        [level:Geocoder\Model\AdminLevel:private] => 1
                                        [name:Geocoder\Model\AdminLevel:private] => New York
                                        [code:Geocoder\Model\AdminLevel:private] => NY
                                    )

                                [2] => Geocoder\Model\AdminLevel Object
                                    (
                                        [level:Geocoder\Model\AdminLevel:private] => 2
                                        [name:Geocoder\Model\AdminLevel:private] => Onondaga County
                                        [code:Geocoder\Model\AdminLevel:private] => Onondaga County
                                    )

                            )

                    )

                [country:Geocoder\Model\Address:private] => Geocoder\Model\Country Object
                    (
                        [name:Geocoder\Model\Country:private] => United States
                        [code:Geocoder\Model\Country:private] => US
                    )

                [timezone:Geocoder\Model\Address:private] =>
                [providedBy:Geocoder\Model\Address:private] => google_maps
            )

        [3] => Geocoder\Provider\GoogleMaps\Model\GoogleAddress Object
            (
                [id:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => ChIJXX3gEb7z2YkRrJj_0-rmXOQ
                [locationType:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => APPROXIMATE
                [resultType:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => Array
                    (
                        [0] => postal_code
                    )

                [formattedAddress:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => Syracuse, NY 13202, USA
                [streetAddress:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [intersection:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [political:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => United States
                [colloquialArea:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => 
                [ward:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [neighborhood:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [premise:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [subpremise:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [naturalFeature:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => 
                [airport:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [park:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [pointOfInterest:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [establishment:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [subLocalityLevels:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => Geocoder\Model\AdminLevelCollection Object
                    (
                        [adminLevels:Geocoder\Model\AdminLevelCollection:private] => Array
                            (
                            )

                    )

                [coordinates:Geocoder\Model\Address:private] => Geocoder\Model\Coordinates Object
                    (
                        [latitude:Geocoder\Model\Coordinates:private] => 43.0481645
                        [longitude:Geocoder\Model\Coordinates:private] => -76.1473156
                    )

                [bounds:Geocoder\Model\Address:private] => Geocoder\Model\Bounds Object
                    (
                        [south:Geocoder\Model\Bounds:private] => 43.030467
                        [west:Geocoder\Model\Bounds:private] => -76.163988
                        [north:Geocoder\Model\Bounds:private] => 43.0564569
                        [east:Geocoder\Model\Bounds:private] => -76.1420219
                    )

                [streetNumber:Geocoder\Model\Address:private] =>
                [streetName:Geocoder\Model\Address:private] =>
                [subLocality:Geocoder\Model\Address:private] =>
                [locality:Geocoder\Model\Address:private] => Syracuse
                [postalCode:Geocoder\Model\Address:private] => 13202
                [adminLevels:Geocoder\Model\Address:private] => Geocoder\Model\AdminLevelCollection Object
                    (
                        [adminLevels:Geocoder\Model\AdminLevelCollection:private] => Array
                            (
                                [1] => Geocoder\Model\AdminLevel Object
                                    (
                                        [level:Geocoder\Model\AdminLevel:private] => 1
                                        [name:Geocoder\Model\AdminLevel:private] => New York
                                        [code:Geocoder\Model\AdminLevel:private] => NY
                                    )

                                [2] => Geocoder\Model\AdminLevel Object
                                    (
                                        [level:Geocoder\Model\AdminLevel:private] => 2
                                        [name:Geocoder\Model\AdminLevel:private] => Onondaga County
                                        [code:Geocoder\Model\AdminLevel:private] => Onondaga County
                                    )

                            )

                    )

                [country:Geocoder\Model\Address:private] => Geocoder\Model\Country Object
                    (
                        [name:Geocoder\Model\Country:private] => United States
                        [code:Geocoder\Model\Country:private] => US
                    )

                [timezone:Geocoder\Model\Address:private] =>
                [providedBy:Geocoder\Model\Address:private] => google_maps
            )

        [4] => Geocoder\Provider\GoogleMaps\Model\GoogleAddress Object
            (
                [id:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => ChIJNf-jRf702YkRWbJ48qyiSrI
                [locationType:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => APPROXIMATE
                [resultType:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => Array
                    (
                        [0] => administrative_area_level_2
                        [1] => political
                    )

                [formattedAddress:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => Onondaga County, NY, USA
                [streetAddress:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [intersection:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [political:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => United States
                [colloquialArea:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => 
                [ward:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [neighborhood:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [premise:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [subpremise:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [naturalFeature:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => 
                [airport:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [park:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [pointOfInterest:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [establishment:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] =>
                [subLocalityLevels:Geocoder\Provider\GoogleMaps\Model\GoogleAddress:private] => Geocoder\Model\AdminLevelCollection Object
                    (
                        [adminLevels:Geocoder\Model\AdminLevelCollection:private] => Array
                            (
                            )

                    )

                [coordinates:Geocoder\Model\Address:private] => Geocoder\Model\Coordinates Object
                    (
                        [latitude:Geocoder\Model\Coordinates:private] => 43.026819
                        [longitude:Geocoder\Model\Coordinates:private] => -76.1783739
                    )

                [bounds:Geocoder\Model\Address:private] => Geocoder\Model\Bounds Object
                    (
                        [south:Geocoder\Model\Bounds:private] => 42.7712569
                        [west:Geocoder\Model\Bounds:private] => -76.499324
                        [north:Geocoder\Model\Bounds:private] => 43.271605
                        [east:Geocoder\Model\Bounds:private] => -75.8960789
                    )

                [streetNumber:Geocoder\Model\Address:private] =>
                [streetName:Geocoder\Model\Address:private] =>
                [subLocality:Geocoder\Model\Address:private] =>
                [locality:Geocoder\Model\Address:private] =>
                [postalCode:Geocoder\Model\Address:private] =>
                [adminLevels:Geocoder\Model\Address:private] => Geocoder\Model\AdminLevelCollection Object
                    (
                        [adminLevels:Geocoder\Model\AdminLevelCollection:private] => Array
                            (
                                [1] => Geocoder\Model\AdminLevel Object
                                    (
                                        [level:Geocoder\Model\AdminLevel:private] => 1
                                        [name:Geocoder\Model\AdminLevel:private] => New York
                                        [code:Geocoder\Model\AdminLevel:private] => NY
                                    )

                                [2] => Geocoder\Model\AdminLevel Object
                                    (
                                        [level:Geocoder\Model\AdminLevel:private] => 2
                                        [name:Geocoder\Model\AdminLevel:private] => Onondaga County
                                        [code:Geocoder\Model\AdminLevel:private] => Onondaga County
                                    )

                            )

                    )

                [country:Geocoder\Model\Address:private] => Geocoder\Model\Country Object
                    (
                        [name:Geocoder\Model\Country:private] => United States
                        [code:Geocoder\Model\Country:private] => US
                    )

                [timezone:Geocoder\Model\Address:private] =>
                [providedBy:Geocoder\Model\Address:private] => google_maps
            )

    )

)`

Nyholm commented 6 years ago

Sure. Have a look at our dumpers: https://github.com/geocoder-php/Geocoder#dumpers

juragandotid commented 6 years ago
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'
Nyholm commented 6 years ago

Could you please use words instead of non formatted code?

juragandotid commented 6 years ago

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.

jbelien commented 6 years ago

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.

juragandotid commented 6 years ago

@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.

jbelien commented 6 years ago

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() !