[gdal-dev] gdalwarp -crop_to_cutline produces non-square pixels for EPSG:3857 (GDAL 1.10.1, released 2013/08/26)

Jesse McGraw jlmcgraw at gmail.com
Thu Feb 5 08:23:06 PST 2015


I'm not sure whether this is a real issue or not but I thought I'd bring it
up, at the very least I'll learn something

When using "gdalwarp -cutline <shapefile> -crop_to_cutline" on an input
raster that is in EPSG:3857 with square-pixels the output raster, while
still EPSG:3857, now has non-square pixels.

They're aren't terribly non-square but aren't they supposed to be
completely square for EPSG:3857?

(FWIW, I see that there are tickets opened that reference similar issues
but they reference the output being shifted or the origin changing, not the
pixel shape changing)

For example:
#Warp our original .tif to EPSG:3857
$gdalwarp \
        -t_srs EPSG:3857 \
        -dstalpha \
        -co TILED=YES \
        "ENR_L33.tif" \
        "./2.tif"

#See that the output pixels are square
$gdalinfo 2.tif
Origin = (-8577554.996301921084523,5421778.172851986251771)
Pixel Size = (43.677179501975118,-43.677179501975118)


#Now crop the image to a cutline
$gdalwarp \
        -crop_to_cutline \
        -dstalpha \
        -cutline "./ENR_L33.shp" \
        -cblend 10 \
        -co TILED=YES \
        "./2.tif" \
        "./3.tif"

#See that output pixels are not square
$ gdalinfo 3.tif
Origin = (-8480047.445924906060100,5366376.137789577245712)
Pixel Size = (43.678439570399853,-43.675457269061347)


I ran some more tests and without the -crop_to_cutline option the output
pixels remain square

Thanks,
  Jesse
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20150205/a1cbd5f4/attachment.html>


More information about the gdal-dev mailing list