This function intersects (extracts) any spatial object (WKT point, multipoints, polygons or multipolygons) with HarvestChoice 5-arc-minute grid and returns an array of intersected gridcell IDs (CELL5M codes) to pass along as argument to getLayer.

getLayerWKT(var, wkt, ...)

Arguments

var
character array of variable names to summarize (all types are accepted)
wkt
unprojected (epsg:4326) WKT representation of a spatial object (points, multipoints, or polygons)
...
other arguments passed to getLayer (e.g. by, collapse, format)

Value

a data.table (or other format) of var indicators summarized across wkt geometri(es)

Examples

# Mean harvested maize area summarized across a custom polygon x <- getLayerWKT("maiz_h", wkt="POLYGON((-16.35819663578485006 15.36599264077935345, -15.42501860768386379 15.69472580976947462, -15.11749403024149174 14.83577785208561117, -16.13550642453347805 14.68731771125136376, -16.35819663578485006 15.36599264077935345))")
#> Warning: grid has empty column/rows in dimension 1
#> Warning: grid has empty column/rows in dimension 2
x
#> ISO3 maiz_h #> 1: SEN 330