plotkml 栅格显示红色 X 而不是图像
plotkml raster displays a red X instead of the image
可以在此处下载光栅图像:
https://github.com/Alexvonrass/BS_Selection_tool/blob/master/data/msc_raster.RDS
我运行这个代码:
r <- readRDS("msc_raster.RDS")
kml(r, colour = r@data@values, file='ms.kml')
然后我收到这些警告(不确定它们是否与问题有关)
KML file opened for writing...
Writing to KML...
Closing ms.kml
Warning messages:
1: In paths(show.paths = TRUE) :
Could not locate GDAL! Install program and add it to the Windows registry. See http://www.gdal.org/ for more info.
2: In paths(show.paths = TRUE) :
Could not locate SAGA GIS! Install program and add it to the Windows registry. See http://www.saga-gis.org/en/ for more info.
我得到了一个 kml 文件,其中包含正确的图例、正确的位置和光栅图像的大小,但不是实际图像而是一个红色的 X:
它确实将所需图像写入 .png,但没有将其写入 .kml
我认为它与 r 写入的 .png 图像的文件名有关,但我目前无法正常工作。
plotKML
似乎弄乱了要显示的 png 的引用。它找不到它,因此是红色 X。
一个简单的解决方法是将参数 raster_name
添加到您的函数调用中:
kml(r,raster_name = 'layer.png', colour = r@data@values, file='ms.kml')
可以在此处下载光栅图像:
https://github.com/Alexvonrass/BS_Selection_tool/blob/master/data/msc_raster.RDS
我运行这个代码:
r <- readRDS("msc_raster.RDS")
kml(r, colour = r@data@values, file='ms.kml')
然后我收到这些警告(不确定它们是否与问题有关)
KML file opened for writing...
Writing to KML...
Closing ms.kml
Warning messages:
1: In paths(show.paths = TRUE) :
Could not locate GDAL! Install program and add it to the Windows registry. See http://www.gdal.org/ for more info.
2: In paths(show.paths = TRUE) :
Could not locate SAGA GIS! Install program and add it to the Windows registry. See http://www.saga-gis.org/en/ for more info.
我得到了一个 kml 文件,其中包含正确的图例、正确的位置和光栅图像的大小,但不是实际图像而是一个红色的 X:
它确实将所需图像写入 .png,但没有将其写入 .kml 我认为它与 r 写入的 .png 图像的文件名有关,但我目前无法正常工作。
plotKML
似乎弄乱了要显示的 png 的引用。它找不到它,因此是红色 X。
一个简单的解决方法是将参数 raster_name
添加到您的函数调用中:
kml(r,raster_name = 'layer.png', colour = r@data@values, file='ms.kml')