package sp, extract values points-lines
On Thu, 24 Nov 2016, rolandh at uni-muenster.de wrote:
Hi Marta, by ?sp::over you will see that SpatialLines are not supported. Moreover it says: "over methods that involve SpatialLines objects, or pairs of SpatialPolygons require package rgeos, and use gIntersects." So, try gIntersects ...
Right, and note that the precision model will bite painfully (the points may appear to be on the lines, but given the precision model may not actually intersect in the default representation (think one thousandth of a millimetre). You may need to buffer either points or lines to get the intersections you expect. Roger
Cheers, Roland marta azores schrieb am 2016-11-24:
Hi everyone,
I need to join two datasets, one with survey boats and other with sightings. There are different boats in the same area. First I've created the tracks with the gps information, and give to each track an ID number(column) . Second, I would like to join by time and space the sightings with the track of the boats. I'm trying the"over" function of the package sp.
The first test was try to join only by space, but the function say there aren't overlap. I don't know why, because the points of the sightings are over the line.
Any idea? Thanks in advance Marta
#boat data
boat <- read.table("path/.csv", header=TRUE, sep=",", na.strings="NA",
dec=".", strip.white=TRUE)#
boatdf<-as.data.frame(boat)
#sighting data
sght <- read.table("path/.csv.csv", header=TRUE, sep=",", na.strings="NA",
dec=".", strip.white=TRUE)#
#Spatial points #sightings Sxy = cbind(sght$LONG,sght$LAT) Spts = SpatialPoints(Sxy) sghtdf<-as.data.frame(sght) #boats xy = cbind(boat$Long1,boat$Lat1) pts = SpatialPoints(xy)
# dataframe ptsdf = SpatialPointsDataFrame(pts, boatdf)#data frame barcos Sptsdf = SpatialPointsDataFrame(Spts, sghtdf)#data frame species
#Line line<-as(ptsdf, "SpatialLines")
# #extract values over(Sptsdf, line)# NA?
[[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
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand Department of Economics, Norwegian School of Economics, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 91 00 e-mail: Roger.Bivand at nhh.no http://orcid.org/0000-0003-2392-6140 https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en http://depsy.org/person/434412