Skip to content
Back to formatted view

Raw Message

Message-ID: <1315412339351-6768425.post@n2.nabble.com>
Date: 2011-09-07T16:18:59Z
From: Fischbach, Anthony
Subject: define projection for Raster data
In-Reply-To: <1315408262230-6768128.post@n2.nabble.com>

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.