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

Add marker to map showing result #213

Closed
scottsfarley93 opened this issue Mar 15, 2019 · 3 comments
Closed

Add marker to map showing result #213

scottsfarley93 opened this issue Mar 15, 2019 · 3 comments
Milestone

Comments

@scottsfarley93
Copy link

It's a little jarring right now to select a search result, have the map fly to those coordinates, and not see anything on the map. It could be a good idea to add a marker to the map indicating the location of the feature that has been returned. We could enable this as an optional feature so those users who manage a custom display of the result could continue to do so.

\cc @katydecorah

@andrewharvey
Copy link
Collaborator

I agree with making this optional, since some developers would be implementing this already and may like to continue to do so. However I see this as providing better defaults out of the box, so 👍

@andrewharvey
Copy link
Collaborator

andrewharvey commented Mar 20, 2019

We'll need to decide what to do with https://docs.mapbox.com/mapbox-gl-js/example/point-from-geocoder-result/ in light of this PR.

Update: ...just saw Updating the Set a point after geocode result to use the new built-in marker functionality in the gl-geocoder

@andrewharvey andrewharvey added this to the v4.0.0 milestone Mar 21, 2019
@scottsfarley93
Copy link
Author

This was implemented in #219 and will the be default behavior once version 4 is released.

A key note about this change is that mapboxgl is now a peer dependency of this package. New mapbox-gl-geocoder instances should set mapboxgl in the constructor options.

If mapboxgl is not found in the constructor options, markers will not be added to the map and an error will be generated in the console, but the plugin will otherwise function as usual.

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