Given a specific lon and lat point c(lon, lat), and a table data that contains a list of lat and lon, we want to:
- calculate the distance between this point to all other lat and lon points in the data and
- return all points from the table that are within 1000 meters from the c(lon, lat)
Tried using distm function but we only succeeded in calculating the distance between c(lon, lat) to one point:
library(spatial)
distm(x, y, fun=distGeo)
distm(data[,3:2], c(40.706914,-74.011322), fun = distHaversine)
 
     
    