On Mon, 19 Jan 2009, Struve, Juliane wrote:

Dear list members,

I would like to look for attributes (e.g. distance from the shore) of spatial points in other data sets (e.g. dist_shoreDF) after matching the points in fishlocationDF and dist_shoreDF by their coordinates.

The most direct way for planar coordinates is to use functions in the spatstat package, to give the distance between a point and a line. You'll need to ceorce from sp objects to spatstat objects using methods in the maptools package, something like:

library(maptools)
library(spatstat)
fish_ppp <- as(as(fishlocationDF, "SpatialPoints"), "ppp")
shore_psp <- as(as(shoreDF, "SpatialLines"), "psp")

As far as I can see, the pairdist method exists for either ppp or psp objects, but not for a combination, but I may be wrong. There is an internal function called distppll() which takes a matrix of points and a single line segment as a matrix, which can be used, but which involves some coding to extract the matrices from the input objects.

http://www.csiro.au/resources/Spatial-Point-Patterns-in-R.html

is a very useful resource, but there isn't too much on line segements yet.

Hope this helps,

Roger

PS. Is there a function in PBSmapping to do this, perhaps handling geographical coordinates?


fishlocationDF$dist=dist_shoreDF$dist[match(dist_shoreDF$coordinates, fishlocationDF$coordinates)] does not work but illustrates what I am trying to do.

How can I deal with the two coordinates that every point has ? Would it be possible to coerce both x and y-coordinate into one column in order in order to apply the match() function ? Or is there a better way of approaching this ? I would be grateful for a hint.

Thank you for your time.

Juliane

        [[alternative HTML version deleted]]

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


--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: roger.biv...@nhh.no

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

Reply via email to