I have a raster object from which I want to extract area weighted mean values from a circle with a specific radius in m. The raster has latitude and longitude wrt to the WGS84 datum.
I can extract values within a circle using
extract and specifying a
buffer, but how can I get a weighted mean?
The raster layer can be downloaded here.
WOA <- readRDS('WOA.RDS') crs(WOA) CRS arguments: +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 xy <- data.frame(x = -40, y = 60) # extract values from cells from circle with 100 km radius extract(WOA, xy, buffer = 1e+5)
but to make use of the
extract I think need to convert xy to a
xy_sp <- SpatialPoints(xy, proj4string = CRS('+proj=longlat +datum=WGS84'))
gBuffer from the
rgeos package to expand the point to a circle with the desired radius (i.e. a SpatialPolygon), but how do I take care of the units since
xt_sp is in degrees? Can I use
spTransform (rgdal) and what (metric) coordinate system would be appropriate for my global dataset?