[R-sig-Geo] Raster-extract function with cluster...
Guillermo E. Ponce-Campos
geponce at gmail.com
Tue Apr 5 10:14:29 CEST 2016
Does anyone has experienced issues using "extract" function from raster
Package using a cluster?
I want to make a simple extraction of pixels from rasters using a
I'm just doing something like:
# Create list with raster filenames
my700.rasters <- list.files("\\.tif$")
# Load shapefile
multiPoly <- shapefile('../muti_polygons.shp')
rstack <- stack(my700.rasters)
rextract <- extract(rstack, multiPoly, fun=mean, na.rm=TRUE, df=TRUE)
Is it possible that the final arrange of data extracted for each polygon
doesn't match the sequence of each polygon within "multiPoly" due to the
parallelization, mixing the sequence of results?
I expect something like this as part of the data.frame (df=TRUE):
ID, Raster1, Raster2, Raster3,...
1, 0.344, 0.444, 0.455,...
2, 1.234, 2.334, 5.444,...
3, 4.555, 6.777,4.666,...
where ID is a sequence of numbers that corresponds to the sequence within
multiPoly at data
ID, OBJECTID, Name, Area
1, 2323, Lake1, 234.33
2, 3444, Pond, 20.33
3, 456, Pond1, 33.33
However, the ID's do not match... If I do it for a single polygon I can
identify the values for that specific polygon. However, when I run it for
several polygons, the polygon identified doesn't m atch with the ID in the
resulting data frame.
Does anyone has experienced something similar?
My guess is that cluster/parallel is mixing the order of the results... I'm
testing without cluster, just to confirm this...
[[alternative HTML version deleted]]
More information about the R-sig-Geo