我正在尝试maptools从一组提取的数据中绘制一系列线条。lat和long数据位于数据long集 72000 点中,另一列包含每条线的标签。对每个点重复此标签。
# from the sp vignette:
M2 = cbind(c(28.55841,25.2479,46.24100,25.24810,25.24570,25.24670,25.24840,28.55820,25.2460),
c(77.11510,55.3591,6.11329,55.35931,55.36831,55.38071,55.35801,77.11601,55.3684)
)
L2 = Line(M2)
# I want to create a loop here to add a new line each time there is a break ie when the line label changes.
# Perhaps there is a better way to organise this step?
S2 = Lines(list(L2), ID="b")
library(maptools)
kmlLines(S2, kmlfile = "zrivers.kml", name = "R Lines",
description = "Hello!", col = "blue", visibility = 1, lwd = 1,
kmlname = "", kmldescription = "")
我收到一条消息
向量中的错误(“字符”,长度(spatialLines@lines)):类“Lines”的这个对象没有名称“lines”的槽
我没有看到创建 Line 对象的简单方法。
将数据推送到形状对象然后使用现有代码(如rivers示例)会更容易吗?