I am mosaicking one meter and three meter rasters to two meters in Python with GDAL Warp using the following code:

cl_string = "-of GTiff -co COMPRESS=LZW -tr 2 2 -tap -r near -overwrite \

warp_options = gdal.WarpOptions(gdal.ParseCommandLine(cl_string))
warp_name = "warpped.tif"    
ds = gdal.Warp(warp_name, vsis_paths, options = warp_options)
ds = None

Which results in the following: enter image description here

The image shows half-width pixels and frequently has gaps (not shown here). How can I ensure the pixels have the correct width?

  • are you sure you're not looking at e.g., neighboring 3 pixels of the exact same value? – Paul H Apr 18 at 21:48

I don't think you have odd-sized pixels. I think you have neighboring pixels with equal values. See the marked up portion of your raster with likely pixel boundaries drawn in:

enter image description here

  • thanks for your note and you seem to be correct. I tested this by using cubic, opposed to near, and loaded the raster into a File Geodatabase. Opening the data in ArcMap, the raster appears much more reasonable. – jwx Apr 19 at 18:49

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.