Closed Yamakasi closed 5 years ago
Hello,
You can get the type
property with getType()
function.
You can see all the properties available in Model/NominatimAddress.php
.
Hi,
Thanks! I would have believed the same but I don't get the options on an Address object so I got confused. I already fiddeled a little but with the code to see why. Can you give a small example maybe ? I can do a toArray() and such, getProvidedBy()...
I don't have time to investigate this right now but I'll do it ASAP :)
Thanks, I'm testing also using the Nominatim tests from the repo, let me know if you find something.
Should it work with registering the provider as well ?
/edit: I tested it out further and it seems to work, I only don't get the hints for getType() and the other ones where I first got an error, maybe that needs some investigation, I'm testing further.
Hello again @Yamakasi ,
I checked and there is nothing wrong, as expected you can get the type
property with getType()
function.
Here is an example :
use Geocoder\Query\GeocodeQuery;
$httpClient = new \Http\Adapter\Guzzle6\Client();
$provider = \Geocoder\Provider\Nominatim\Nominatim::withOpenStreetMapServer($httpClient, $_SERVER['HTTP_USER_AGENT']);
$geocoder = new \Geocoder\StatefulGeocoder($provider, 'en');
$result = $geocoder->geocodeQuery(GeocodeQuery::create('Buckingham Palace, London'));
echo $result->first()->getType();
Thank you @jbelien. I see that you solved this issue.
I wonder if there is a way to get the type property from the address object and also the other info which is in a nominatim response object (and maybe others as well).