-1

I'm using Angular 10 and ngx-leaflet. I have two points with lat and lng, how can I calculate distance (in meter) between these points? I need display it in template, is it some method to calculate it? Thanks.

emka26
  • 433
  • 1
  • 11
  • 28

1 Answers1

0

Instead of using a method to calculate the distance, you can simply use the coordinates of the two points you want to use and do a little bit of math. The formula to calculate the distance between two points in a 2D space is rather simple : Formula 1

But in a 3D space it's a bit more complicated, but still easy to use : Formula 2

lucasdctr
  • 5
  • 5