[R-sig-Geo] Import raster from ArcGIS - mismatch between original GRID and raster in R

Jenn.B jsbarret at sfu.ca
Wed Dec 7 20:01:32 CET 2011


Thanks for your quick replies!

Okay - Barry, you are right in that I was "mislead" by the raster plot in R.
I had used the plot() function to examine the raster, transition layer and
geocorrected transition layers in R, followed by points(), and found that,
based on the plot (I exported to .pdf), the point where the error occured
was now on land and that the raster looked to be resampled (or rather
'downsampled' as you correctly point out). Exporting the rasters above to
ascii files and opening them in ArcGIS shows that this is indeed just
associated with the R plotting and that the rasters are in fact identical to
the one I imported. Likewise if I used the zoom() function. So that's good. 

However, I'm now totally puzzled as to why I'm getting this error. Note that
the code is running fine and producing good results for other nests, and for
other foraging locations associated with this nest. All files have the same
projection (NAD1983 Albers). This is actually the 24th nest, and the 41st
foraging point for the 24th nest - all points before this are processed just
fine. As a side note - the birds nest on land, but forage on the water, and
tend to follow waterways (i.e., streams and then ocean) to access foraging
sites and nests, rather than flying over land.

I've attached .csv files of the nest and the location, as well as the raster
file. A simplified code to use just these files is below. I've also attached
a .pdf exported from ArcGIS that shows the route is connected (note that
both the location and the nest are on value pixels). 

Thanks,
Jenn

CODE:
r.CS<- raster ("C:/ForR/ds_ocfly75f") 

plot(r.CS, useRaster=TRUE)

# Create transition layer

t.CS<- transition(r.CS, transitionFunction=mean, directions=16)

# Correct values for distortion

tc.CS<- geoCorrection(t.CS)

# Import nest and forage location

setwd("C:/ForR")
nest1<-read.csv("nest.csv")
radio1<-read.csv("forageloc.csv")

nestXY<- cbind(nest1$X_COORD, nest1$Y_COORD)
radioXY<-cbind(radio1$X_COORD, radio1$Y_COORD)

nestXY
radioXY

SpRadio<-SpatialPoints(radioXY)
SpRadio

SpNest<-SpatialPoints(nestXY)
SpNest

sPathL<-shortestPath(tc.CS, SpNest, SpRadio, output="SpatialLines")

# (line above is where I get the error msg)

http://r-sig-geo.2731867.n2.nabble.com/file/n7071696/nest.csv nest.csv 
http://r-sig-geo.2731867.n2.nabble.com/file/n7071696/forageloc.csv
forageloc.csv 
http://r-sig-geo.2731867.n2.nabble.com/file/n7071696/ds_ocfly75f.zip
ds_ocfly75f.zip 
http://r-sig-geo.2731867.n2.nabble.com/file/n7071696/MapNestForageLoc.pdf
MapNestForageLoc.pdf 

--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Import-raster-from-ArcGIS-mismatch-between-original-GRID-and-raster-in-R-tp7068880p7071696.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list