[R-sig-Geo] over spatialPoints with spatialPolygons

Agustin Lobo alobolistas at gmail.com
Mon Apr 16 19:40:06 CEST 2012


Dieter,

You get what the manual says:
"returns a data.frame of the second argument with row entries
corresponding to the first argument"

If you want to join this information to the data frame of your points,
you can use merge() with the @data slot of Point1, or, as they are in
the same order,
I think that even cbind() would do it:

over_test2 <- cbind(Point1 at data,over_test)
If you need a SpPointsDF:
Point2 <- Point1
Point2 at data <- over_test2

but check that the order of the rows in over_test and Point1 at data is the same

Agus

El día 16 de abril de 2012 18:31, Dieter Mayr <dieter.mayr at boku.ac.at> escribió:
> Hi everyone,
>
> i have a pretty simple question, but I just don't figure out how it
> works correctly. Maybe one could give me a hint.
>
> I have a SpatialPointsDataFrame 'Point1' (energy_id, energy_value) and
> a SpatialPolygonsdataframe 'Poly1' (house_id, district,...).
> By using the command "over", I want get a table consisting of the all
> points with the information of the Polygons:
>
> Point_id/energy_value/ House_id/ District
> 1   /  10  /  1  /  A
> 2   /  12  /  1  /  A
> 3   /  13  /  2  /  B
> 4   /   9   /  2  /  B
>
>
> if I use:
> over_test <- over (Point1, Poly1)
>
> I get a table, but it only consists of the information from the
> SpatialPolygonsDataFrame 'Poly1', but no informtion about the energy
> value...
> What can I do, that I get this information into my new over_test table
> ??
> Thanks very much for any help,
>
> Dieter Mayr
>
>
> ----------------------------------------------------------
> Mag. Dieter Mayr
> Institut für nachhaltige Wirtschaftsentwicklung
> Department Wirschafts- und Sozialwissenschaften
> Universität für Bodenkultur Wien
> A-1180 Wien | Feistmantelstrasse 4
> Tel  +43 1 47654-3594
> eMail: dieter.mayr at boku.ac.at
> Web: www.wiso.boku.ac.at/454.html
>
> ----------------------------------------------------------
>
>        [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



More information about the R-sig-Geo mailing list