简体   繁体   English

多边形的ID与spatialpolygonsdataframe中的@data ID不同

[英]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.

相关问题 合并合并数据后,spacepolygonsdataframe多边形混杂不清 - spatialpolygonsdataframe polygons jumbled after merge to join data 简化rgeos中的多边形并在SpatialPolygonsDataFrame中维护数据 - Simplifying polygons in rgeos and maintaining data in SpatialPolygonsDataFrame SpatialPolygonsDataFrame中多边形的属性值 - Attribute values to polygons in SpatialPolygonsDataFrame 如何通过简化R中的两个SpatialPolygonsDataFrame对象来创建新多边形? - How to create new polygons by simplifying from two SpatialPolygonsDataFrame objects in R? 从shapefile获取具有多边形id和Centroid(lat long)信息的数据框 - Get data frame with polygons id and Centroid (lat long) information from shapefile 一个spacePolygonsDataFrame行的子集面 - Subset polygons of a single spatialPolygonsDataFrame row 将 function 应用于 R 中 SpatialPolygonsDataFrame 的多边形 - Applying a function to polygons of a SpatialPolygonsDataFrame in R ggplot2; 将来自不同数据集的点和栅格/矩阵数据添加到空间多边形数据框的图上 - ggplot2; Adding points from a different dataset and a raster/matrix data to a plot of a spatialpolygonsdataframe 从SpatialGridDataFrame和SpatialPolygonsDataFrame中的数据屏蔽栅格 - Masking raster from data in SpatialGridDataFrame and SpatialPolygonsDataFrame 从map_data转到SpatialPolygonsDataFrame - Go from map_data to SpatialPolygonsDataFrame
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM