1

I have a basic Leaflet map where I need to draw several markers and lines on. How do I prevent the map from panning to the last drawn object?

I've read about setting autopan : False for popups from here.

Can the autopan : false option work for leaflet markers?

  • 2
    Are you saying that you digitize a new element, and then the map automatically zooms to that element? And that you want to avoid that? If your code is not too long you might also want to share it, so it would be easier to solve the issue. – BritishSteel Feb 3 '15 at 13:12
  • It's a pretty basic problem. I'll see if I can put together an example – FredFury Feb 3 '15 at 13:19
  • That'd be nice. Just not entirely sure if I understood the question, hence I was asking. – BritishSteel Feb 3 '15 at 13:26
0

It appears that you can.

var markerWithoutPan = new L.Marker([0, -10], {
    draggable: true,
    autoPan: false,
    title: 'NoPan'
});

Source

Leaflet docs for Markers

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.