Quantcast

define projection for Raster data

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

define projection for Raster data

didimayr
Hi all,
 

I have a very simple problem, I just want to define a projection for raster data. However I have no experience with spatial analysis with R, so maybe someone could give me a hint:
 
My data are radiation raster data for Austria, in .asc-format .
I have the following information:
 
Map projection: geographic (latitude/longitude), ellipsoid WGS84
North: 49N
South: 46:30N
West:  9:30E
East:   17:30E
Resolution 1'30''
 
...giving a total of 100 rows and 320 columns.

Is this information enough to get the right projection and if yes, how do I define it in R?
 
Thank you so much and kind regards
Dieter Mayr from Vienna
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: define projection for Raster data

Anthony Fischbach
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@usgs.gov
http://alaska.usgs.gov/science/biology/walrus
Loading...