[R-sig-Geo] Attach values from polygons to points

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Mon Sep 6 10:21:12 CEST 2010


On Mon, Sep 6, 2010 at 8:02 AM, Jens Oldeland <oldeland at gmx.de> wrote:
> Hi,
>
> I am working with two shapefiles in R; one is a point.shp the other is a
> polygon.shp. Now, I would like to intersect/join/attach all the values from
> the polygon to the table of the point.shp.
>
> I tried overlay() and spRbind in package sp, but nothing did what I expected
> them to do.
>
> Could anyone give me a hint how I can combine both shapefiles?
>

 You could read the reply I posted on stackoverflow :) But the short answer is:

 overlay(pts,polys) returns the index of the row of polys that the
points in pts are inside. How did this not work for you?

Barry



More information about the R-sig-Geo mailing list