Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a large raster, which I want to re-project and crop for a new location that I'm creating in GRASS. I seem to have gotten the re-projection and cropping right with this call to gdalwarp:

gdalwarp -t_srs EPSG:32142 \
  NE1_HR_LC_SR_W.tif \
  -te -1246270.9107927915 -186894.1315662132 2391103.024689787 2372883.4615327567 \

Unfortunately, the resolution of the target file is much lower than that of the source file. I see in the gdalwarp documetation that the argument -tr specifies the target file's resolution, but it is not clear to me how to specify that the target file's resolution should be that of the source file.

share|improve this question
up vote 3 down vote accepted

The -tr option takes explicit values in the target srs georeferenced units. So, to match the resolution of the input raster you need to find out the resolution of the original (let's say it is 10m with square pixels). You would then set the switch

-tr 10 10

If you want to read the resolution of the input raster and automatically set the -tr value (say for a batch process), you will need to do it programatically.

share|improve this answer

As you correctly Identify the flag -tr help you specify the destinations pixel resolution in georeferenced unitss. eg:

gdalwarp -tr 10 10 input.tif output.tif

YOu should also to check the -r flag, which specifies the method that will be user if any interpolation would happen. Currently the -r flag can be used to specify 5 (+2 if you're using gdal 1.10) methods :

near, bilinear, cubic, cubicspline, lanczos, average (GDAL >= 1.10.0), mode(GDAL >= 1.10.0)

By default gdalwarp uses the NN interpolation, which is the worst interpolation quality according gdalwarp manual.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.