Open mikebronner opened 5 years ago
I've just double checked by running the test suite and it seems to be working correctly.
Can you share the code you are using to get the result, and the address you are geocoding?
Thanks
Hello, thank you for your reply.
I got it working, but the returned search result are a bit confusing.
Strange error. This works in Nominatim but returns error from this driver.
>>> $addresses = app('geocoder')->geocode('113 46, Stockholm')->dump('geojson');
TypeError: Return value of Geocoder/Dumper/GeoJson::dump() must be of the type string, bool returned
>>>
This however works
$addresses = app('geocoder')->geocode('113 45, Stockholm')->dump('geojson');
>>> multiple results
Inconsistent results: Via geocoder
>>> $addresses = app('geocoder')->geocode('Idungatan 7c, 113 45, Stockholm')->dump('geojson');
=> Illuminate\Support\Collection {#3489
all: [],
}
Via the search field in Algolia app, places, dashboard I do get a suggestion, even though it is not the correct lat/long. (It suggests the city "Stockholm" in Sweden) Suppose this is not this repos fault :). I was expecting the same result or any result.
{
"query": "Idungatan 7c, Stockholm",
"suggestion": {
"name": "Stockholm",
"country": "Sverige",
"countryCode": "se",
"type": "city",
"latlng": {
"lat": 59.3326,
"lng": 18.0649
},
"postcode": "100 05",
"highlight": {
"name": "<em>Stockholm</em>",
"country": "Sverige"
},
"value": "Stockholm, Sverige"
}
}
Hmm. I've double checked that the code is querying correctly without any filters and I still get no results.
Could this be due to https://www.algolia.com/doc/api-reference/api-parameters/aroundLatLngViaIP/?
I am not sure. This is all very new to me. Did you look into the first error?
@tanthammar
I'm guessing it's related to that. Can you try direct with that param disabled?
In regards to the first error, could you please add dd(json_last_error())
after the geocode call?
I'm pretty sure something is going borked with the array which causes the json encode to fail.
Thanks!
@tanthammar
Were you able to do the above?
@tanthammar
Were you able to do the above?
Asking on behalf of @tanthammar, who posted this issue here: https://github.com/geocoder-php/GeocoderLaravel/issues/163
General Information
GeocoderLaravel Version: ^4.2 Laravel Version: 6 PHP Version: 7.3.8 Operating System and Version: OSX 10.14.6
Issue Description
I do understand that this might not be the proper place to ask, but I was hoping that someone might have a solution. :)
Unable to get this to work with the Algolia geocoder provider No errors, but always an empty collection returned.
(I have it working with the Nominatim and GoogleMaps)
Steps to Replicate
in
config/geocoder.php
Stack Trace
[if an error is occuring, provide the complete stack trace here]