[R-sig-Geo] matching points to a raster
Alexander Brenning
brenning at uwaterloo.ca
Fri Jun 5 21:39:59 CEST 2009
Hi Juliane,
may I also suggest having a look at the pick.from.ascii.grid function
(and the like) in the RSAGA package. This will use nearest neighbour
interpolation (or, for reasonably small grids, may also use an ad hoc
local kriging interpolation) to pick grid values (from grids with
numeric data).
http://cran.r-project.org/web/packages/RSAGA/RSAGA.pdf
There are some more suggestions in the R-sig-geo archives:
https://stat.ethz.ch/pipermail/r-sig-geo/2008-October/004469.html
http://www.mail-archive.com/r-sig-geo@stat.math.ethz.ch/msg04662.html
I hope this helps
Alex
> Struve, Juliane wrote:
>> Dear list,
>>
>> I am trying to incoporate spatial information (for example distance)
>> into a movement model by reading an ascii -b converted raster and
>> matching the raster with points of a movement path (for example
>> fishmove$coord[fishmove$day==1]. Below is a section of my code to
>> explain the problem. This code does not work because the coordinates
>> of the movement path are not the same as those in the raster. Rounding
>> the coordinates does not seem to solve the problem. Maybe the closest
>> point would have to be found, but i am not sure how to approach this.
>> Is there another perhaps easier way ?
>>
>> Dist_DF=data.frame(readAsciiGrid("distance.txt"))
>> Dist_shoreDF$coord = paste(round(Dist_DF$s1),round(Dist_DF$s2),sep=",")
>> names(Dist_DF)[1]="Dist"
>> Dist_DF$Dist[Dist_shoreDF$coord==fishmove$coord[fishmove$day==1]]
>>
>> I would be grateful for any help.
>>
>> Many thanks,
>>
>> Juliane
--
Alexander Brenning
brenning at uwaterloo.ca - T +1-519-888-4567 ext 35783
Department of Geography and Environmental Management
University of Waterloo
200 University Ave. W - Waterloo, ON - Canada N2L 3G1
http://www.fes.uwaterloo.ca/geography/faculty/brenning/
More information about the R-sig-Geo
mailing list