Dear list,

thank you for all the helpful replies and suggestions (on-line and off-line) .

I am currently using import.asc() and join.asc() from the adehabitat package after renaming the file.txt file to be imported to file.asc and I am looking at other solutions that were suggested.

Many thanks again for your time.
Juliane




________________________________
From: milton ruser [milton.ruser@gmail.com]
Sent: 06 June 2009 23:42
To: Struve, Juliane
Subject: Re: [R-sig-Geo] matching points to a raster

Have you tryed rename the .TXT raster to .ASC and read it using import.asc?
bests

mc

On Sat, Jun 6, 2009 at 5:29 PM, Struve, Juliane <j.struve@imperial.ac.uk<mailto:j.struve@imperial.ac.uk>> wrote:
Hi,

thank you very much for your reply.

I have tried using join.asc() with my ascii converted (dist_shore.txt) and a list of points in the dataframe fishmove for which I would like to have attributes. But I get a list of NAs as an output.

library(adehabitat)
Dist_shoreDF=data.frame(readAsciiGrid("dist_shore.txt"))
Dist_shoreM=as.matrix(Dist_shoreDF)
Dist_shoreASC=as.asc(Dist_shoreM)
join.asc(cbind(fishmove$UTMX,fishmove$UTMY),Dist_shoreASC)

Am I missing something ?

Best regards,

Juliane

________________________________
From: milton ruser [milton.ruser@gmail.com<mailto:milton.ruser@gmail.com>]
Sent: 05 June 2009 21:03
To: ksafi@orn.mpg.delibrary(adehabitat<mailto:ksafi@orn.mpg.delibrary(adehabitat>)
Cc: Struve, Juliane; r-sig-geo@stat.math.ethz.ch<mailto:r-sig-geo@stat.math.ethz.ch>
Subject: Re: [R-sig-Geo] matching points to a raster

Hi there,

How about join.asc at adehabitat packages?
I have done this kind of points-raster overlap without problem using that funcion.

Cheers

milton

On Fri, Jun 5, 2009 at 2:49 PM, Kamran Safi <ksafi@orn.mpg.de<mailto:ksafi@orn.mpg.de>> wrote:
Hi,

I am not sure this is trivial. I think the simplest solution would be to find the closest grid cell centre (maybe using spDistN1 or simple vector length) and get the closest grid cell with environmental data and assign it to your animals' position. You can further complicate things by not taking simply the next closest point, but calculate the weighted mean (using the inverse of distance of the cell centres to the animals' location as weighing variable) or maybe most elegantly use kriging (or linear models), and extrapolate the value for the location. This is a classical geographers' problem of interpolation and not simply done by overlay(), which probably mimics the first solution of getting the next best grid cell (I am also not entirely sure whether overlay works with spatialPoints and spatialPixels).
Weighted mean maybe a straightforward solution.

Hope this helps,

Kami


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







       [[alternative HTML version deleted]]

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




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




	[[alternative HTML version deleted]]

