2014-01-21 36 views
0

我有一个shape文件和spatialPointsDataframe ......我想选择所有的多边形,其中有一点(S)内,并在小水电合并点的信息@数据r选择已用空间点多边形内部

word<-readOGR(dsn="data/world/ne_110m_admin_0_countries.shp", layer="ne_110m_admin_0_countries") 
xy<-cbind(geoloc$longitude,geoloc$latitude) 
spxy<-SpatialPoints(xy) 
spdfxy<-SpatialPointsDataFrame(spxy,geoloc) 
[email protected]<-merge([email protected],data2000geo) 

tps<-!is.na(over(spdfxy,word)) ##retourne the indexe of atribut of y renvois les atribut de word 

但之后我不知道如何选择多边形。我曾尝试

vitiWord<-word[tps] 

,但它不适用于下载为例工作

- >link

+0

你可以制作一个可重现的例子吗?这将有很大的帮助 – dickoa

+0

我没有尝试,但可能word [tps,]可以工作 – dickoa

+0

不,它不工作丝毫[tps,]。 tps是一个逻辑向量,我没有一个表中的变量来完成像[tps == TRUE] – delaye

回答

0

我必须找到一些东西...... 我不真的知道是否因为工作我想使用ggplot后,它不能很好地工作,但惠特

jointure<-over(word,spdfxy) #over from sp library 
[email protected]<-cbind([email protected],jointure) 

你有所有的变量从spatialDataFrame点!