pointsOver: To find the if points are within a polygon shapefile given a...

View source: R/pointsOver.R

pointsOverR Documentation

To find the if points are within a polygon shapefile given a set of coordinates

Description

To find the if points are within a polygon shapefile given a set of coordinates

Usage

pointsOver(
  lon,
  lat,
  lands,
  projection = "+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0"
)

Arguments

lon

A numeric vector with longitude information.

lat

A numeric vector with latitude information.

lands

Layer from which the geometries or attributes are queried. This arguments allows 'SpatialPolygons' or 'SpatialPolygonsDataFrame' class objects.

projection

Character string describing a projection and datum in the PROJ.4 format.

Value

This function return 'TRUE' or 'FALSE' label based on whether the point is on land or not.

Examples

## Not run: # Create an artificial data set
x = data.table(lat=1:10, lon=1:10)
world = rnaturalearthdata::countries50
x$label = pointsOnLand(x$lon, x$lon, world)
head(x)

## End(Not run)

GranadoIgor/miscellaneousR documentation built on Sept. 20, 2023, 12:34 p.m.