smeijer / leaflet-geosearch

A geocoding/address-lookup library supporting various api providers.
https://smeijer.github.io/leaflet-geosearch/
MIT License
1.03k stars 273 forks source link

Leaflet Map does not Center to Location after search #229

Closed Joel-Wong0794 closed 3 years ago

Joel-Wong0794 commented 4 years ago

Hi,

For some reason, the map does not center to the point of search result. It is able to autoComplete, but nothing happens after that.

I tried to check the object output from the search. mymap.on('geosearch/showlocation', function(result) { console.log(result); });

However, it returned a "TypeError: Cannot convert undefined or null to object".

Hope that someone can assist. Thank you!!

rawhasan commented 4 years ago

Me too getting the same error. Please let know if you've found a solution for this.

qzminski commented 4 years ago

Same problem, the source of an error seems to be located in https://github.com/smeijer/leaflet-geosearch/blob/develop/src/SearchControl.ts#L360

SearchControl.ts:412 Uncaught (in promise) TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at i.showResult (SearchControl.ts:412)
    at SearchControl.ts:404
qzminski commented 4 years ago

Looks like once I updated from 3.0.0 to 3.0.5 the problem is gone.

smeijer commented 4 years ago

@NightFury555 & @rawhasan, which version do you use?

yznts commented 3 years ago

Seems like problem already fixed in the latest patch releases. I'll close this issue, but if you're still getting this behaviour, please, re-open it.

nobbiexxx commented 2 years ago

I'm getting the same thing with version 3.6.0 Has anyone figured it out?

Uncaught (in promise) TypeError: Cannot convert undefined or null to object at Function.keys () at i.showResult (SearchControl.ts:412:28) at SearchControl.ts:404:12

Cheppar commented 1 year ago

Hello nobbiexxx All i did was to update the version in the link and script. <link rel="stylesheet" href="https://unpkg.com/leaflet-geosearch@3.6.0/dist/geosearch.css" />

  <script src="https://unpkg.com/leaflet-geosearch@3.6.0/dist/geosearch.umd.js"></script>

  This worked for me, I hope it does for you.