Find minimum distance between each starting point in x and possible end points, y.

dist_min(x_df, y_df, x_id = "id", y_id = "id", x_lon_col = "lon",
  x_lat_col = "lat", y_lon_col = "lon", y_lat_col = "lat",
  dist_function = "Haversine")

Arguments

x_df

DataFrame with starting coordinates

y_df

DataFrame with ending coordinates

x_id

String name of unique identifer column in x_df

y_id

String name of unique identifer column in y_df

x_lon_col

String name of column in x_df with longitude values

x_lat_col

String name of column in x_df with latitude values

y_lon_col

String name of column in y_df with longitude values

y_lat_col

String name of column in y_df with latitude values

dist_function

String name of distance function: "Haversine" (default) or "Vincenty"

Value

DataFrame with id of closest point and distance in meters