R 中计算轮廓时出错
Error in computing contours in R
我正在尝试使用 R
为 LST(地表温度)文件生成等高线
lst<-raster("test_lst.tif")
cl <- contourLines(lst,20)
shp <- ContourLines2SLDF(cl)
但是,我得到的错误是
Error in contourLines(lst, 20) : no proper 'z' matrix specified
我知道该命令需要 x
、y
(坐标)和 z
(在本例中为 LST 值)。但是,我无法以这种格式放置我的数据。我尝试使用 as.matrix
将我的文件转换为矩阵,但问题仍然存在。
虽然 contourLines
对我不起作用,但我使用 rasterToContour
并且效果很好。
cnt <- rasterToContour(lst)
writeOGR(cnt, "lst_contour", layer="cnt", driver="ESRI Shapefile")
我正在尝试使用 R
为 LST(地表温度)文件生成等高线lst<-raster("test_lst.tif")
cl <- contourLines(lst,20)
shp <- ContourLines2SLDF(cl)
但是,我得到的错误是
Error in contourLines(lst, 20) : no proper 'z' matrix specified
我知道该命令需要 x
、y
(坐标)和 z
(在本例中为 LST 值)。但是,我无法以这种格式放置我的数据。我尝试使用 as.matrix
将我的文件转换为矩阵,但问题仍然存在。
虽然 contourLines
对我不起作用,但我使用 rasterToContour
并且效果很好。
cnt <- rasterToContour(lst)
writeOGR(cnt, "lst_contour", layer="cnt", driver="ESRI Shapefile")