lonLatFilter | R Documentation |
lonLatFilter
Tests whether lon/lat positions fall within a defined
box of lon/lat borders. Exact matches with southern and western borders are included.
lonLatFilter(lon_vector, lat_vector, west, east, south, north)
lon_vector |
Longitude 1 (in decimal degrees) |
lat_vector |
Latitude 1 (in decimal degrees) |
west |
West longitude border (decimal degrees) |
east |
East longitude border (decimal degrees) |
south |
South latitude border (decimal degrees) |
north |
North latitude border (decimal degrees) |
Vector of position inclusion in the defined lon/lat borders
set.seed(1)
n <- 1000
Pos <- list(lon=runif(n, min=-180, max=180), lat=runif(n, min=-180, max=180))
# Check to see if positions are withing boundaries
res <- lonLatFilter(Pos$lon, Pos$lat, -20, 20, -40, 40)
# Plot
op <- par(mar=c(4,4,1,1))
plot(Pos$lon, Pos$lat, pch=21, col=1, bg=2*res)
rect(-20, -40, 20, 40, border=3)
par(op)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.