Find all observations in a data.frame within a circle of a certain radius.
points_in_circle( data, lon_center, lat_center, lon = lon, lat = lat, radius = 200 )
data | data.frame with at least columns for longitude and latitude. |
---|---|
lon_center | numeric value referencing to the longitude of the center of the circle |
lat_center | numeric value referencing to the latitude of the center of the circle |
lon | column name in |
lat | column name in |
radius | radius (in meters) (defaults to 200m). |
data.frame. Column distance_m
gives the distance to the center of the circle (in meters).
Martin Haringa
points_in_circle(Groningen, lon_center = 6.571561, lat_center = 53.21326, radius = 60) #> # A tibble: 3 × 10 #> street number letter suffix postal_code city lon lat amount distance_m #> <chr> <int> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> #> 1 Heresin… 5 NA NA 9711EP Groni… 6.57 53.2 5 31.4 #> 2 Heresin… 11 NA NA 9711ER Groni… 6.57 53.2 11 47.8 #> 3 Zuiderp… 1003 NA NA 9724AK Groni… 6.57 53.2 1003 57.6