Hi Gianni,

Roger Bivand helped me with a similar problem a little while ago.   
Here is a solution.
		
		# Here I take a list of long, lat coordinates, each set is  
identified by a particular statistical reporting unit
		group1<-lapply(seq(along=stat_areas), function(x)  
Polygons(list(Polygon(as.matrix(stat_areas[[x]]))),
			ID=names(stat_areas)[x]))
	group2 <- SpatialPolygons(group1)
	# The list has now been turned into a SP polygon

	# Do the overlay with a SpatialPointsDataFrame
	o <- overlay(group2, ddat)	

	# Extract all 'ID' from the polygon set, this is my 'Statistical_areas'

	IDs <- sapply(slot(group2, "polygons"), function(x) slot(x, "ID"))
	# Use the overlay to get the correct assignment of the  
'Statistical_areas'
	ddat$area <- factor(IDs[o])

Good luck,

Jon Loehrke
Graduate Research Assistant
Department of Fisheries Oceanography
School for Marine Science and Technology
University of Massachusetts
200 Mill Road, Suite 325
Fairhaven, MA 02719
jloehrke@umassd.edu
T 508-910-6393
F 508-910-6396


#
# Sorry for this email, but i have a problem with overlay in sp.
#
# I have to shape file one is a points shape file (clip_point, with "pH"
# value) the second is a Polygons shapefile (plots, with ID number of  
plot)
#
# clip_point <- readOGR(".", "clip_point")
# proj4string(clip_point) <- CRS("+init=epsg:26911")
# names(clip_point)[4] = "pH"
# str(clip_point)
#
# plots <- readOGR(".", "plots")
# proj4string(plots) <- CRS("+init=epsg:26911")
# str(plots)
#
# I wish to overlay both shapefiles to have a data.frame with ID and  
pH value
# (in other words, find all points insiede the plot x)
#
# clip_point.ov <- overlay(plots["ID"],clip_point["pH"] )
#
# when I try this solution I have a data.frame with the total numebr of
# clip_point but with only the ID and not pH value.
#
# data.frame':   2992 obs. of  1 variable:
# $ ID: int  15 15 15 15 15 15 15 15 15 15 ...
#
# thanks a lot and sorry for this question
#
# Gianni
	[[alternative HTML version deleted]]

