[英]polygons' ID different from @data ID in a spatialpolygonsdataframe
I loaded a shapefile in R using readOGR
and I named as data.map
我使用
readOGR
在R中加载了shapefile,并将其命名为data.map
I can see the shape pretty well by using 通过使用我可以很好地看到形状
plot(data.map)
The issue is that polygons' ID (the ID of the plot) is not the same with the @data
ID. 问题是多边形的ID(图的ID)与
@data
ID不同。 What I mean is that, when I run: 我的意思是,当我跑:
plot(data.map[2, ])
and then run 然后跑
data.map@data[2, ]
the polygon that is drawn in the plot is not the one that the data row refers to. 绘图中绘制的多边形不是数据行引用的多边形。
I do not know if i can delete the question. 我不知道我是否可以删除这个问题。 I found the solution.
我找到了解决方案。 the problem was that after a merge procedure many of the @data rows were deleted and that resulted to have the ids messed.
问题是,在合并过程之后,许多@data行被删除,结果导致ID混乱。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.