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 \
NE1_HR_LC_SR_W_32142.tif
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.
Answer
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.
No comments:
Post a Comment