[R-sig-Geo] Determining in which polygon points lie

Dieter Vanderelst dieter.vanderelst at ua.ac.be
Fri Jun 14 17:51:18 CEST 2013


Dear List,

I'm reading in a shapefile of a country with different subregions in the 
shapefile (the shapefile was downloaded from the GADM database of Global 
Administrative Areas). I also have a number of points. Therefore, my 
code looks like this (using the maptools package):

country<-readShapePoly(file)
points<-readShapePoints(file)

Now, I want to know in which of the N regions of the country each of the 
spatial points lies? Is there an easy way to do this? I know there is a 
function points.in.poly in sp. But this functions seems incompatible 
with the objects created by the maptools functions. Also, this function 
requires looping over the regions in a set.

Regards,
Dieter

---
Behavioural, Acoustic and Sensory Ecology Lab
University Bristol, UK

http://bitsofbats.weebly.com/



More information about the R-sig-Geo mailing list