[R-sig-Geo] Create a simple spatial grid

Remi Genevest rgenevest at free.fr
Wed May 21 18:14:58 CEST 2014


Thanks a lot Barry. Your post perfectly matches what I was looking for.

Well now if I want to do a coarser grid covering Europe, what I should do is
doing more or less the same thing, just to change the resolution, right? 

res(r)=c(100,100)  # an approximate 100meters squared cells

Then I got my raster in a EU coordinates system, and I would like to
transform it into a WGS 84 (so as adding other layers would become easier).
I tried this way, but it doesn't work :

# change the CRS into WGS84 (ll)
r.new<-projectRaster(r,crs="+init=epsg:4326") 
# adapt the extent to Europe
ext = extent(-10.417,31.917,34.083,71.083)
extent(r.new)<-ext
# plot the map
plot(r.new,axes=TRUE)
# Here I get a plot that is not projected in a proper way.

So, I wondered if avoiding the projectRaster() function would be alright :

# Change only the extent adapt the extent to Europe
ext = extent(-10.417,31.917,34.083,71.083)
extent(r)<-ext
projection(r)<-"+init=epsg:4326"
plot(r,axes=TRUE)

Am I wrong ?!

Best regards
Rémi



--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Create-a-simple-spatial-grid-tp7586481p7586490.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list