Map Reprojection
Question
How to change map/image projections, datums, etc in GRASS GIS?
Answer
- create an import location in the projection and datum of the map/image you want to import
- import the map/image into the location
- create a destination location in the projection and datum you want to reproject the map/image into
- working in the destination location, use r.proj or v.proj (depending on whether the map/image is raster or vector) to reproject the map/image from the import location to the destination location.
If your raster data set is too big (i.e., 2GB or so when using an outdated GRASS GIS version), r.proj might crash. Instead, export as a GeoTIFF, use gdalwarp
to change the project and then import the new GeoTIFF file. If you have installed gdal
, you almost certainly have gdalwarp
as well. Directions for gdalwarp
are at http://www.gdal.org/gdalwarp.html. The options for gdalwarp
are a bit confusing for newbies. In the following example of projecting a GeoTIFF based on SRTM elevation data to UTM 37N, -t_srs
is the output file projection, AfricaHornElev.tif
is the input file and AfricaHornElev37n.tif
is the output file.
gdalwarp -t_srs '+proj=utm +zone=37 +ellps=WGS84 +datum=WGS84 +units=m +no_defs' -r bilinear AfricaHornElev.tif AfricaHornElev37n.tif
Another (similar) strategy frequently needed when maps need to be imported using, e.g. v.in.ogr or r.in.gdal, is to tell these programs to create a new location (argument "location"). If the imported data contains proper PROJ_INFO
files, they can be reprojected into the current mapset, using the the projection in the current location/mapset.