Geodistance Precision What is the distance between points. How many digits of accuracy to put on my location records.
Let’s look with the GeoDesic library in Python.
The Function First, the function:
import pandas as pd from geopy.distance import geodesic def geodist(lat1, lon1, lat2, lon2): coords = pd.Series([lat1, lon1, lat2, lon2]) if coords.isnull().values.any(): return None return round(geodesic((lat1, lon1), (lat2, lon2)).km, 5) The Test Using this python cell, we can generate distance based on the last digit; 5th or 6th decimal place.
read more