4
我嘗試將具有多行的空間對象(從OSM檢索到的河流)轉換爲KML。對於單行的對象,使用kmlLine很容易。然而,多行下面的方法是不工作,我嘗試從the documentation適應的例子是徒勞的:將具有多行元素的SpatialLinesDataframe轉換爲R中的KML
# get OSM data:
library(osmar)
library(maptools)
salzach <- get_osm(relation(408582), full = T)
sp_salzach <- as_sp(salzach, what = "lines")
# convert to KML:
kmlLine(sp_salzach, "salzach.kml", lwd = 3, col = "blue", name = "Salzach")
Warning:
In kmlLine(sp_salzach, "salzach.kml", lwd = 3, col = "blue", name = "Salzach") :
Only the first Lines object with the ID '23633534' is taken from 'obj'
# shell.exec("salzach.kml")
謝謝 - 幫助! – Kay