简体   繁体   English

在sp中使用over函数:保留空间特征

[英]Using over function in sp: Preserving spatial charactersitics

Hi I'm using the over function in sp package and wondering if it preserves the spatial characteristics in the results. 嗨,我在sp包中使用over函数,想知道它是否在结果中保留了空间特征。 As you know spatial characteristics is necessary to joint the data to another dataset to perform analysis. 如您所知,空间特征对于将数据连接到另一个数据集以执行分析是必要的。

for example: I have a control datset as spatialPointsDataFrame and slope as spatialGridDataFrame. 例如:我有一个控件数据集为spatialPointsDataFrame,坡度为spatialGridDataFrame。 I want to use over as follows: 我想使用如下:

> Slope.ov = over(control, Slope)  # the result is:
 'data.frame':  500 obs. of  1 variable:
 $ slope: num  NaN 0.477 0.87 1.172 0.534 ...

And then I want to add the data extracted to the control dataset. 然后,我想将提取的数据添加到控件数据集中。 How can I make sure that the data added to control dataset is spatially in correct position? 如何确保添加到控件数据集中的数据在空间上处于正确位置?

> control$slope =Slope.ov$slope

over preserves the order of data. over保留数据顺序。 So, if you add your vector as you suggest it, data will be added in the good order to the right position. 因此,如果按照您的建议添加向量,数据将以良好的顺序添加到正确的位置。

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

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