7

Is it possible to 'fly to location' in Leaflet in the same way as this Mapbox GL example?

8

map.flyTo() is available in Leaflet 1.0.

However the parameters are different from those in the example. See http://leafletjs.com/reference-1.0.0.html#map-flyto

flyTo(<LatLng> latlng, <Number> zoom?, <Zoom/pan options> options?)

Example:

flyTo([13.87992, 45.9791], 12)

  • 1
    Have you seen any examples of its use? Or any detailed documentation on the parameters? – Joshua Dickerson Nov 2 '15 at 10:13
  • 1
    Leaflet implementation is much lighter than MapBox obviously: jsfiddle.net/3v7hd2vx – ghybs Nov 2 '15 at 10:31
  • Perfect, yes as you say it is a lot lighter but it does the job, cheers! – Joshua Dickerson Nov 2 '15 at 10:33
  • Is it possible to make the map 'render' as the animation is happening, for example, for a marker.cluster layer to expand as the map animates? – Joshua Dickerson Nov 2 '15 at 22:02
0

Yes, flyTo() function in Leaflet 1.0 (in Beta at the moment). Demo http://regionbound.com/leaflet-fly-demo

  • 2
    flyTo() is nice, but the effect seems to be kind of lost when you don't get tiles reloading faster enough, like in regionbound demo. Has anyone made any progress with this? Does it work better with vector tiles? Can we preload tiles? – chrismarx Feb 5 '18 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.