I have a GeoTiff that has been supplied to me with non square pixels (I suspect due to reprojection to lat lon at some point). However the next step in my processing chain requires a Arc ASCII grid as input and so I need square pixels.

To save me trying to guess the original projection can any one tell me how to use GDAL to resample my image so the pixels become square?


It's not something I've tried, but I think you can do it with gdalwarp:

gdalwarp -tr 10.0 -10.0 -r bilinear src.tif dst.asc

You would choose a -tr value based on the smallest value of the source's resolution, remembering to negate the y scale if it's a top-down image. gdal_translate has an -outsize parameter that might do the job, but it may just truncate the image, or at best use nearest neighbour interpolation.

I'd be interested in what you find, because sooner or later it's going to happen to someone else!

  • This works nicely, only issue is that you can't translate to ascii grid with gdalwarp so you need an intermediate tif and then use gdal_translate. – Ian Turton Jun 21 '12 at 13:41
  • I'm glad it works! Shame about the two-stage process, but that's the nature of text-based formats I guess. – MerseyViking Jun 21 '12 at 13:58
  • There is -tr parameter in gdal_translate for setting the target resolution and -r parameter for selecting the resampling method, both documented in gdal.org/gdal_translate.html. – user30184 Nov 6 '15 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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