gWhichPoints: Return indices of points within a box

Description Usage Arguments Details Examples

Description

Like gBoundingPoints but only returns the indices of points contained within a bounding box

Usage

1
gWhichPoints(allpoints, b_box)

Arguments

allpoints

A SpatialPoints or SpatialPointsDataFrame object

b_box

A set of bounding coordinates in matrix form like those returned from sp::bbox()

Details

Rather than returning the spatial object, this give the indices of points within a bounding box. It's more useful for re-merging attributes (Since gBoundingPoints strips a SpatialPointsDataFrame to a SpatialPoints object). Or, better still, subsetting.

Note: all inputs should be of class sp::SpatialPolygons|Points

Examples

1
2
gWhichPoints(points.spdf, bbox(container_polygon))
all_the_points_spdf[gWhichPoints(all_the_points.spdf, bbox(container_polygon)), ]

townleym/mSpatial documentation built on May 31, 2019, 6:46 p.m.