简体   繁体   English

如何从空间多边形数据集中为数据框指定坐标

[英]How to assign coordinates to a data frame from a Spatial polygon dataset

I have a Spatial polygon dataset with 16 features 我有一个具有16个功能的空间多边形数据集

Deforested_areas_sp
class       : SpatialPolygons 
features    : 16 
extent      : 30.95493, 31.02964, -1.040257, -0.9624111  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0

I want to assign the coordinates of these 16 features to a dataframe which also contains 16 features. 我想将这16个要素的坐标分配给一个数据帧,该数据帧还包含16个要素。 Below is dataframe. 下面是数据帧。

Att_table_S01_E031_Mod_df
  ID      AREA LU_1990 LU_2000 LU_2005 CHLU_90_00 CHLU_00_05     Tile       UNIQ_ID D_90_00 D_00_05
1   597  274408.8      11      15      15       1115       1515 S01_E031  S01_E031_597    <NA>    <NA>
2   622  249063.6      11      15      15       1115       1515 S01_E031  S01_E031_622    <NA>    <NA>
3   816   90260.9      11      15      15       1115       1515 S01_E031  S01_E031_816    <NA>    <NA>
4   818  210709.6      11      15      15       1115       1515 S01_E031  S01_E031_818    <NA>    <NA>
5   886  260828.1      11      15      15       1115       1515 S01_E031  S01_E031_886    <NA>    <NA>
6   898 1029736.2      11      15      15       1115       1515 S01_E031  S01_E031_898    <NA>    <NA>
7   935  413891.1      11      15      15       1115       1515 S01_E031  S01_E031_935    <NA>    <NA>
8  1139  272603.0      11      15      15       1115       1515 S01_E031 S01_E031_1139    <NA>    <NA>
9  1169  230945.5      11      15      15       1115       1515 S01_E031 S01_E031_1169    <NA>    <NA>
10 1192  451941.1      11      15      15       1115       1515 S01_E031 S01_E031_1192    <NA>    <NA>
11 1196  270798.2      11      15      15       1115       1515 S01_E031 S01_E031_1196    <NA>    <NA>
12 1203  278951.3      11      15      15       1115       1515 S01_E031 S01_E031_1203    <NA>    <NA>
13 1244  388546.4      11      15      15       1115       1515 S01_E031 S01_E031_1244    <NA>    <NA>
14 1435  105058.9      11      15      15       1115       1515 S01_E031 S01_E031_1435    <NA>    <NA>
15 1436  249060.9      11      12      15       1112       1215 S01_E031 S01_E031_1436    <NA>    <NA>
16 1437  187476.3      11      15      15       1115       1515 S01_E031 S01_E031_1437    <NA>    <NA>
      Sour_90_00    Sour_00_05
1  Modis500_2000 Modis500_2005
2  Modis500_2000 Modis500_2005
3  Modis500_2000 Modis500_2005
4  Modis500_2000 Modis500_2005
5  Modis500_2000 Modis500_2005
6  Modis500_2000 Modis500_2005
7  Modis500_2000 Modis500_2005
8  Modis500_2000 Modis500_2005
9  Modis500_2000 Modis500_2005
10 Modis500_2000 Modis500_2005
11 Modis500_2000 Modis500_2005
12 Modis500_2000 Modis500_2005
13 Modis500_2000 Modis500_2005
14 Modis500_2000 Modis500_2005
15 Modis500_2000 Modis500_2005
16 Modis500_2000 Modis500_2005

However, I have not managed yet to find a way to make the transformation. 但是,我还没有找到办法进行转型。 Help on this would be very appreciated. 对此的帮助将非常感激。

Using: 使用:

spdf = SpatialPolygonsDataFrame(Sr, data, match.ID = FALSE)

it should create a SpatialPolygonsDataFrame using a SpatialPolygons object Sr for the geometry and a data frame data for the data. 它应该创建一个SpatialPolygonsDataFrame使用SpatialPolygons对象Sr的几何和数据帧data为数据。

This assumes both are in the same order, otherwise re-order the data frame. 这假设两者的顺序相同,否则重新排序数据帧。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM