Reputation: 95
I have been having a problem using the terra package. When I perform raster extracts on a polygon data set with weights=TRUE, I sometimes get many warning messages. From interpreting the warnings, it seems like perhaps terra is trying to write temporary files to perform this operation (?) and does not have write permissions. So I respecified the tempdir for the terra package to a folder I made that has read and write permissions, yet I still get these warnings.
Has anyone else received similar warnings from terra and know either how to solve the problem, or if these warnings are likely to be of any consequence (i.e. could they affect the reliability of the extract values)?
Thanks for reading.
In the below code bisondist is a raster layer, US.County is a sf object with polygons (10 is the column containing the geometries)
bison.mean.us <- terra::extract(bisondist,vect(US.County[,10]), fun=mean,na.rm=TRUE,weights=TRUE)
warnings()
Warning messages:
1: Attempt to create new tiff file `/spat_j1J6nrrhKYxy9MQ.tif' failed: Read-only file system (GDAL error 4)
2: Pointer 'hDS' is NULL in 'GDALGetRasterBand'.
(GDAL error 10)
3: Pointer 'hObject' is NULL in 'GDALSetDescription'.
(GDAL error 10)
4: Pointer 'hBand' is NULL in 'GDALSetRasterNoDataValue'.
(GDAL error 10)
5: Pointer 'hBand' is NULL in 'GDALFillRaster'.
(GDAL error 10)
6: Pointer 'hDS' is NULL in 'GDALSetGeoTransform'.
(GDAL error 10)
7: Pointer 'hDS' is NULL in 'GDALSetProjection'.
(GDAL error 10)
8: Pointer 'hDS' is NULL in 'GDALGetRasterBand'.
(GDAL error 10)
9: Pointer 'hBand' is NULL in 'GDALGetRasterDataType'.
(GDAL error 10)
10: Pointer 'hBand' is NULL in 'GDALGetRasterNoDataValue'.
(GDAL error 10)
11: Pointer 'hDS' is NULL in 'GDALRasterizeGeometries'.
(GDAL error 10)
Upvotes: 0
Views: 199
Reputation: 47491
This is not a coding question, rather a bug report, and these should be reported here. This was fixed in terra 1.4-13
.
Upvotes: 1