I have spatially superimposed points in two layers from which I want to copy one column of attributes to the other layer. In QGIS you can do this with 'Join attributes by location' which worked great.
Now I want to write these steps in an R script using the R package rgrass7, which allows me to include GRASS GIS in R. Unfortunately I can't find a suitable equivalent to 'Join attributes by location' in GRASS GIS.
To give more background information:
I want to calculate the distance (as the crow flies) between locations and a river system. Therefore I calculated a network with v.net.connect
and extracted the sections between the locations and the river with v.select.intersect
. From this I got lines (of the sections), from which I could calculate the length with v.to.db
, which I then saved in a column in the sections. Then I used v.to.points
to create end nodes which got the length information. And now I want to copy exactly this length information into the attribute table of the locations. The places contain important information like a column with numbers which I need for further calculations and without I can't assign these points to other data later.
This may be a lot more complicated than it has to be, or 'thought around the corner', but in QGIS this method has worked.
A selected section between the location and the river with the length in the attribute table I want to transfer to sites:
ERROR: Incompatible column types
int
tov.db.addcolumn
. It also works with the lines generated withv.net.connect
so I don't need to create the nodes anymore.