Hi Edzer and list,

Thanks for the package, the command over() essentially achieves my intended result, which is to overlay a set of (2500) points onto a set of (1000) polygons where each polygon receives all of the attribute data from each of the points located within its boundary.

I simply used

over(towns,ea_map)

and the output appears to be correct.  But how to actually create the map, which I am then planning to export with the writeOGR() function.

I tried

map <- SpatialPolygonsDataFrame(over(towns,ea_map))

but it returns the following error

Error in stopifnot(length(Sr@polygons) == nrow(data)) : trying to get slot "polygons" from an object (class "data.frame") that is not an S4 object.

I was also thinking to just create an index for the enumeration areas and then bind/join them after, but it seems I am missing the more direct route.  Any tips?

Thanks!
Ty


On Oct 21, 2012, at 10:03 PM, Edzer Pebesma wrote:

Ty, you might want to read about over() and aggregate() in sp:

http://cran.r-project.org/web/packages/sp/vignettes/over.pdf

If you want to combine polygons with polygons, package rgeom contains
the required further over() methods.

Comments welcome,

On 10/21/2012 09:03 PM, Frazier, Tyler James wrote:

Hi,

Is there a way to do a spatial join: MANY to ONE --  and still retain all the feature characteristics in R?  I want to join several towns, villages etc...to a tract of land (survey enumeration area) and keep the names of all the towns, villages, etc...as part of the spatial join.  I am wondering if it would be worthwhile to try using the manageR plugin through QGIS, or readOGR and then run some type of spatial aggregate() function and then writeOGR or perhaps using postGIS with both R and QGIS.  I would prefer to keep my programming to R and not have to introduce postGIS and additional commands, unless there were some significant long-term advantages, such as better integration between R and QGIS or perhaps another open source.

All advice and suggestions are welcome.

Thanks!
Ty

Begin forwarded message:

Subject: Re: [Qgis-user] spatial join, many to 1
Date: October 21, 2012 2:10:52 AM GMT+02:00

Agreed,

Qgis is not really a spatial data management tool, use a spatial database for that, then use QGIS as a gui to interact with the database.

Whether you use Spatialite, MySQL or Postgis (from the FOSS world) depends on how powerful you want your database solution to be. QGIS works very well with Spatialite & Postgis.

Subject: Re: [Qgis-user] spatial join, many to 1
Date: Sunday, October 21, 2012, 12:03 PM

Hey Tyler,

My advice would be to load you data into a spatialite database and use that to run your query. It will give you the most control.  Have a look at the QSpatialite plugin, it will let you load in your QGIS layers and run queries.

Sent: 21/10/2012 8:54 AM
Subject: [Qgis-user] spatial join, many to 1
Hi,

Is there a way to do a spatial join: MANY to ONE --  and still retain all the feature characteristics in QGIS?  I want to join several towns, villages etc...to a tract of land and keep the names of all the towns, villages, etc...as part of the spatial join.  I have done something similar in R with aggregate() but without the spatial component.  Any advice suggestions are welcome.

Thanks!
Ty



-----
Tyler Frazier
Department of Transportation Planning and Telematics
Technical University Berlin
http://www.vsp.tu-berlin.de/





[[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


--
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics      e.pebesma@wwu.de

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-----
Tyler Frazier
Department of Transportation Planning and Telematics
Technical University Berlin
http://www.vsp.tu-berlin.de/





	[[alternative HTML version deleted]]

