[R-sig-Geo] matching points by their coordinates

Marcelino de la Cruz marcelino.delacruz at upm.es
Tue Jan 20 10:13:07 CET 2009




At 08:49 20/01/2009, Roger Bivand wrote:
>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.

Maybe

dist_fish_shore <-   project2segment(fish_ppp, shore_psp)



Best,

Marcelino



>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 at 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.Bivand at nhh.no
>
>_______________________________________________
>R-sig-Geo mailing list
>R-sig-Geo at stat.math.ethz.ch
>https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
>---------------------------------------------------------------------------------------------------
>Texto añadido por Panda IS 2008:
>
>Este mensaje NO ha sido clasificado como SPAM. 
>Si se trata de un mensaje de correo no 
>solicitado (SPAM), haz clic en el siguiente 
>vínculo para reclasificarlo: 
>http://localhost:6083/Panda?ID=pav_3774&SPAM=true&path=C:\Documents%20and%20Settings\mcr\Configuración%20local\Datos%20de%20programa\Panda%20Software\AntiSpam
>---------------------------------------------------------------------------------------------------

________________________________

Marcelino de la Cruz Rot

Departamento de  Biología Vegetal
E.U.T.I. Agrícola
Universidad Politécnica de Madrid
28040-Madrid
Tel.: 91 336 54 35
Fax: 91 336 56 56
marcelino.delacruz at upm.es




More information about the R-sig-Geo mailing list