Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

246
Views
Best approach to replicate Google Map's "re-center" when user interacts with the map in navigation mode using Leaflet JS

I have a leaflet map where I allow the user to turn on a mode where the map will follow and update their location every 30 seconds. This is implemented with a button click that corresponds to an ActiveLocation = true variable, and as long as it is set to true the map will check for location every 30 seconds and display a location pin and center the view to it. This is needed because the map is used while users are on the move.

Problem

Sometimes users want to check something on the map while ActiveLocation is enabled and they do that without disabling it. Because the map re-centers the view every 30 seconds their work is interrupted. because there is no way to differentiate between the user moving the map and the map moving due to the map.locate() function I have no way of knowing when the user intentionally initiated the change and pause the activeLocation until they request it back.

Are you aware of an efficient and clean way to achieve that? And is there any extension for leaflet that allows features similar to Google Maps' navigation?

Thanks!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!