[R-sig-Geo] define projection for Raster data

Anthony Fischbach afischbach at usgs.gov
Wed Sep 7 18:18:59 CEST 2011


Dear Dieter,
Please refer to the documentation of rgdal and sp.  Also as another newbie
to spatial data in R, I can strongly recommend starting your reading with
Bivand, Pebesma and Gómez-Rubio (2008: Applied Spatial Data Analysis with R. 
Springer).

To cast your raster map into a spatialPixelDataFrame, you will need to write
a script that has these elements.
require(rgdal) 
require(sp)
##read ascii grid using GDAL binding
map <- readGDAL("[your working directory]/map.asc") 
## coerce into a spatialPixelDataFrame
hab <- asc2spixdf(map) 
## Assign a Coordinate Reference System using a PROJ.4 string
prj <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 + 
...[please see http://trac.osgeo.org/proj/wiki/GenParms to set your specific
parameters]")  
proj4string(hab) <- prj

HTH
Anthony



-----
Tony Fischbach, Wildlife Biologist
Walrus Research Program
Alaska Science Center
U.S. Geological Survey
4210 University Drive
Anchorage, AK 99508-4650

AFischbach at usgs.gov
http://alaska.usgs.gov/science/biology/walrus
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/define-projection-for-Raster-data-tp6768128p6768425.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list