View source: R/points_in_circle.R
points_in_circle | R Documentation |
This function selects rows from a data frame whose longitude/latitude coordinates fall within a given radius (in meters) from a specified center point. It also calculates the distance of each point to the center.
points_in_circle(
data,
lon_center,
lat_center,
lon = lon,
lat = lat,
radius = 200,
sort = TRUE
)
data |
A data frame containing at least longitude and latitude columns. |
lon_center |
Numeric scalar, longitude of the circle center. |
lat_center |
Numeric scalar, latitude of the circle center. |
lon |
Name of the longitude column in |
lat |
Name of the latitude column in |
radius |
Numeric, circle radius in meters. Default is 200. |
sort |
Logical, if |
A data frame subset of data
with an extra column
distance_m
giving the distance to the center point.
Martin Haringa
points_in_circle(Groningen, lon_center = 6.571561, lat_center = 53.21326,
radius = 60)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.