Skip to content

FlyTo speed geocoder result #51

Closed
Closed

Description

@martinrisseeuw

Just a quick question, is it possible to adjust the flyto speed of the geocoder since the FlyTo option is a boolean.

Activity

  1. tristen commented on Jul 22, 2016

    @tristen
    Member

    That was a bit of an oversight on my part. flyTo should 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 own map.flyTo.

    var geocoder = new mapboxgl.Geocoder({
      flyTo: false
    });
    
    geocoder.on('result', function(e) {
      var result = e.result;
      map.flyTo({
        // Pass result and custom animation
      });
    });
  2. martinrisseeuw commented on Jul 28, 2016

    @martinrisseeuw
    Author

    @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.

  3. tristen commented on Jul 28, 2016

    @tristen
    Member

    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.

  4. martinrisseeuw commented on Aug 3, 2016

    @martinrisseeuw
    Author

    @tristen Great, thanks for the help.

  5. tristen commented on Aug 3, 2016

    @tristen
    Member

    Oh! we should keep this open. I think we should totally pass flyTo options over!

  6. reopened this on Aug 3, 2016
  7. andrewharvey commented on Oct 25, 2016

    @andrewharvey
    Collaborator

    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.

  8. lbud commented on Nov 3, 2016

    @lbud

    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).

  9. self-assigned this
    on Nov 22, 2016
  10. added this to the v4.0.0 milestone on Mar 13, 2019
  11. andrewharvey commented on Mar 20, 2019

    @andrewharvey
    Collaborator

    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 fitBounds when a bbox is found, and fitBounds also supports GL JS CameraOptions and AnimationOptions https://docs.mapbox.com/mapbox-gl-js/api/#map#fitbounds

    cc @scottsfarley93

  12. scottsfarley93 commented on Mar 20, 2019

    @scottsfarley93

    👍 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.

  13. scottsfarley93 commented on Mar 22, 2019

    @scottsfarley93

    This was done in a combination of #227 and #214. It will be available once version 4 is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions