You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As an interim solution you can set flyTo: false, listen for the result and write your own map.flyTo.
vargeocoder=newmapboxgl.Geocoder({flyTo: false});geocoder.on('result',function(e){varresult=e.result;map.flyTo({// Pass result and custom animation});});
@tristen Thanks for the reply, seems to work now. Only problem that I have now is that with the standard geocoder it zooms further if the address is more specific. How should I add this to the custom animation? Do you have any suggestions for this.
Well this is travelling further down a rabbit hole but you can infer from the source code that it actually fits to bounds if the address is less specific and zooms to fixed zoom if it's more specific.
Oh! we should keep this open. I think we should totally pass flyTo options over!
Agreed, for my use case it would nice to reset the pitch to 0 by simply passing it as an option to flyTo rather than rolling my own on result event handler.
This would be great — there's a lot moving in the Mapbox GL Camera API right now (mapbox/mapbox-gl-js#2801); we should do this after that lands (as it is, mapbox-gl-geocoder uses different camera methods depending on the result).
👍 didn't realize these properties were available on the fitBounds method was well. I think we should pass any custom camera/animation options to the fitBounds calls as well.
Activity
tristen commentedon Jul 22, 2016
That was a bit of an oversight on my part.
flyToshould pass on the options available in https://www.mapbox.com/mapbox-gl-js/api/.As an interim solution you can set
flyTo: false, listen for the result and write your ownmap.flyTo.martinrisseeuw commentedon Jul 28, 2016
@tristen Thanks for the reply, seems to work now. Only problem that I have now is that with the standard geocoder it zooms further if the address is more specific. How should I add this to the custom animation? Do you have any suggestions for this.
tristen commentedon Jul 28, 2016
Well this is travelling further down a rabbit hole but you can infer from the source code that it actually fits to bounds if the address is less specific and zooms to fixed zoom if it's more specific.
martinrisseeuw commentedon Aug 3, 2016
@tristen Great, thanks for the help.
tristen commentedon Aug 3, 2016
Oh! we should keep this open. I think we should totally pass
flyTooptions over!andrewharvey commentedon Oct 25, 2016
Agreed, for my use case it would nice to reset the pitch to 0 by simply passing it as an option to flyTo rather than rolling my own on result event handler.
lbud commentedon Nov 3, 2016
This would be great — there's a lot moving in the Mapbox GL Camera API right now (mapbox/mapbox-gl-js#2801); we should do this after that lands (as it is, mapbox-gl-geocoder uses different camera methods depending on the result).
andrewharvey commentedon Mar 20, 2019
With #214 in mind, slated for v4.
I think we should try to decide if those flyTo options are also applied when fitting the map to a geocode bbox.
mapbox-gl-geocoder uses
fitBoundswhen a bbox is found, andfitBoundsalso supports GL JS CameraOptions and AnimationOptions https://docs.mapbox.com/mapbox-gl-js/api/#map#fitboundscc @scottsfarley93
scottsfarley93 commentedon Mar 20, 2019
👍 didn't realize these properties were available on the fitBounds method was well. I think we should pass any custom camera/animation options to the fitBounds calls as well.
scottsfarley93 commentedon Mar 22, 2019
This was done in a combination of #227 and #214. It will be available once version 4 is released.