F
F
frontjss2019-11-22 09:52:00
Python
frontjss, 2019-11-22 09:52:00

How to find the distance in meters between two points (longitude, latitude)?

You just need to get the distance in meters between 2 geotags.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rsa97, 2019-11-22
@Rsa97

https://stackoverflow.com/questions/365826/calcula...

A
Alexander, 2019-11-22
@NeiroNx

from math import *
def haversine(koord1,koord2):
    """
    Calculate the great circle distance between two points 
    on the earth (specified in decimal degrees)
    """
    # convert decimal degrees to radians 
    lon1, lat1, lon2, lat2 = map(radians, [koord1[0],koord1[1],koord2[0],koord2[1]])
    # haversine formula 
    dlon = lon2 - lon1 
    dlat = lat2 - lat1 
    a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2
    c = 2 * asin(sqrt(a)) 
    # Radius of earth in kilometers is 6371
    dist = 6371000 * c
    return dist

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question