I have two input files.
First: CSV file with a list of points each defined with Lng, Lat, Name
Second: ESRI Shape file defining a number of polygons
I would like to determine for each point I have (from the CSV file) which polygon does it fall inside (if any) ?
I will be using R.
I know that this might be a straightforward task but I am totally a newbie to GIS.
I have done somesearch, and I have found that I can use "MapTools" package in R to load the ESRI shape file.. but I don't know how to move after that..
I managed to read the shapefile using
readShapePoly function in the
MapTools package.. and Now I can plot the polygons and iterate through them in R. I also loaded the points from the CSV file into a data frame with two columns (lng, lat).. Now I need to check for each point which polygon does it fall inside (if any) ..
I managed to do this using the function
over from package
sp in the way explained here However I am getting NA result for all points which is unexpected. I think it is due to different projections for the points and polygons.. Examining the polygons loaded from the shape file using summary function gives me
Is projected: NA, proj4string : [NA]
Any tips ?
Any advice, good tutorial or code sample showing how to do that would be highly appreciated.