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

164
Views
Get distance between two markers in react-leaflet

I have two variables:

const userPos = { lat: 68.39918004344189, lng: -55.54687500000001 }
const solution = { lat: 58.722598828043395, lng: -36.92504882812501 }

I need to get the distance between the two. What I tried was:

userPos.distanceTo(solution)

Also:

distanceTo(userPos, solution)

Also:

const userPosLng = userPos.lng
userPosLng.distanceTo(solution.lng) //tried both with .lat as well

and finally:

const userPosLng = userPos.lng
distanceTo(userPosLng, solution.lng)

None of these worked, and only these were what I found in the documentation and on the internet. So I am now out of ideas, and I would appreciate some help.

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!