Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zoom, marker, adress issue #156

Closed
wuk986 opened this issue Mar 19, 2017 · 3 comments
Closed

zoom, marker, adress issue #156

wuk986 opened this issue Mar 19, 2017 · 3 comments

Comments

@wuk986
Copy link

wuk986 commented Mar 19, 2017

I have some issues and i can not figure it out how to solve this by my own.

My issues short discriptive:

  • Is it possible to zoom in and focus automaticly after searching an POI or address?
  • Is it possible to show always the marker by searching a street without an number?
  • Is it possible to show the whole address and coordinates in the popup after searching an objekt like "objectname, country"?

And last but not least, sometimes after some search requests it is not possible to zoom in and out by the mouse wheel, only the zoom buttons work. After a page reload can solve this for the moment.
I haven't figured what i have done before this occurs.

I am using leaflet 1.0.3, firefox 52, chrome 57

thanks for helping in advance.

@louh
Copy link
Contributor

louh commented Mar 21, 2017

Hi @wuk986,

Is it possible to zoom in and focus automaticly after searching an POI or address?

We have a code snippet showing how you can customize how the map view works after someone selects a a result: https://github.com/mapzen/leaflet-geocoder/tree/master/examples#customize-map-view-when-a-result-is-selected

It uses events to listen for the selection and then responds by panning the map to the correct point and sets the desired zoom level. If you want to set the zoom immediately after a search, and not a selection, you can listen for the results event instead.

Is it possible to show always the marker by searching a street without an number?

The easiest way to do this is to set the overrideBbox option to true. This will force all features that are not truly representable by a point to drop a marker anyway on its centroid.

With custom coding, you can also use events to listen for a selection, examine them to see if the feature.properties.layer property is street, then drop your own markers with Leaflet, but you'll also need to manage the lifecycle of these markers yourself.

Is it possible to show the whole address and coordinates in the popup after searching an objekt like "objectname, country"?

Setting custom popup content via geocoder options is an open issue and still on the roadmap for a future release. Please weigh in there if you have any thoughts about how this might work. In the meantime, this can only be done by listening for a selection event, then handling it yourself by dropping a Leaflet marker and popup with the desired content. (Similarly to above, markers and popups made in this way must also be cleaned up yourself because the plugin does not know about them.)

sometimes after some search requests it is not possible to zoom in and out by the mouse wheel, only the zoom buttons work.

It is possible for an interaction with the results list to switch the map's scrollWheelZoom option off, and perhaps not turn it back on, under certain conditions. This looks like an actual bug, and we will investigate this. Thanks for reporting it!

I hope this is helpful! Please feel free to follow up with any further questions.

@louh
Copy link
Contributor

louh commented Mar 21, 2017

Regarding this bug:

sometimes after some search requests it is not possible to zoom in and out by the mouse wheel, only the zoom buttons work.

I have determined that one way to cause this reliably is to do the following:

  1. Type in some input, causing a list of results to appear.
  2. Hover over the results list with your mouse.
  3. Press escape. The results list should disappear.
  4. Now use the scroll wheel on the map, it does not cause the map to zoom in or out.

I do not know if this is the only way to cause this bug to appear. Are you able to retrace step-by-step how this bug occurs on your end and can confirm whether this is how you're encountering it, or through some other way?

@louh
Copy link
Contributor

louh commented Apr 3, 2017

Scroll wheel zoom issue fixed in 374e3b7 and released in https://github.com/mapzen/leaflet-geocoder/releases/tag/v1.8.2!

@louh louh closed this as completed Apr 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants