R Levelplot sp";转换失败“;
我在像这样的水平图上添加了一个图层R Levelplot sp";转换失败“;,r,sp,R,Sp,我在像这样的水平图上添加了一个图层 levelplot(x)+layer(sp.lines(shape,col='black',lwd=2)) 其中x >x dimensions : 90, 180, 16200 (nrow, ncol, ncell) resolution : 1.999556, 1.867778 (x, y) extent : -180, 179.92, -78.1, 90 (xmin, xmax, ymin, ymax) coord. ref.
levelplot(x)+layer(sp.lines(shape,col='black',lwd=2))
其中x
>x
dimensions : 90, 180, 16200 (nrow, ncol, ncell)
resolution : 1.999556, 1.867778 (x, y)
extent : -180, 179.92, -78.1, 90 (xmin, xmax, ymin, ymax)
coord. ref. : NA
data source : in memory
names : layer
values : -12.23738, 19.81 (min, max)
和shape
>shape
class : SpatialPolygonsDataFrame
features : 101
extent : -180, 180, -85.47029, 90 (xmin, xmax, ymin, ymax)
coord. ref. : NA
variables : 5
names : ID, NAME, Gazetteer_, NEWID, NEWNAME
min values : 1, Adriatic Sea, 1904, 17, Arctic
max values : 9, Yellow Sea, 5698, 67, South Pacific
gpclibPermit()
union <- unionSpatialPolygons(shape, ID=shape@data$NEWID)
unionid <- sapply(slot(union, "polygons"), function(x) slot(x, "ID"))
uniondf <- data.frame( ID=1:length(union), row.names = unionid)
union <- SpatialPolygonsDataFrame(union, uniondf)
但是,如果我添加union
而不是shape
> union
class : SpatialPolygonsDataFrame
features : 7
extent : -180, 180, -85.47029, 90 (xmin, xmax, ymin, ymax)
coord. ref. : NA
variables : 1
names : ID
min values : 1
max values : 7
我得到这个错误:
In grid.Call.graphics(L_text, as.graphicsAnnot(x$label), ... :
conversion failure on 'unable to find an inherited method for function ‘sppanel’ for signature ‘"function"’' in 'mbcsToSbcs': dot substituted for <80>
有什么帮助吗?会不会
sp.polygons()
产生与sp.lines()
相同的错误?我只要求考虑到你有一个多边形数据框,这是强迫成线。我不确定这是否与您的问题有关,只是我注意到了一些问题。请尝试使用除union
以外的其他名称;错误消息表明在某个地方使用了函数联合
,而不是对象。