I think I'm experiencing a gdalwarp bug. Maybe two gdal bugs? Dark-colored
blocks and misregistered output from a VRT with about a dozen or so ground
control points. The problem looks like this:
http://mike.teczno.com/img/gdalwarp-darkness/landcover-1km-merc-z7.jpg
http://mike.teczno.com/img/gdalwarp-darkness/landcover-tiles.jpg
Sample files linked below.
Possible Bug #1: Dark blocks in gdalwarp output.
I have a TIFF of landcover for North America, downloaded from
nationalatlas.gov. The original is in a Lambert projection that's slightly off
by a few km and I need it in spherical mercator for tiling, so I've created a
VRT file with ground control points expressed in the projection of the original.
Original data from here:
http://nationalatlas.gov/mld/landcvi.html
Both of my files linked here:
http://mike.teczno.com/img/gdalwarp-darkness/landcover-1km-rgb.tif (8MB
TIFF)
http://mike.teczno.com/img/gdalwarp-darkness/landcover-1km-to-merc.vrt
When I convert the VRT to tiles using GDAL's python bindings, I get darkened
tiles but only at one specific scale that's close to the original scale of the
image. The output looks like this at zoom=7:
http://mike.teczno.com/img/gdalwarp-darkness/landcover-tiles.jpg
The color in the top-left corner of the image is correct, while the color in
the bottom right corner of the image is darkened but fades out to normal as you
pan south and east. If you zoom out to z6 or in to z8, the problem disappears -
it exists *only* at z7, a scale very close to the native scale of the source
image.
I thought that I could get around all this by pre-projecting the image in one
shot to a spherical mercator TIFF and then having the tiles cut from that
image. When I warp it to an image at zoom=7, the dark, block-shaped areas
appear again:
http://mike.teczno.com/img/gdalwarp-darkness/landcover-1km-merc-z7.jpg
Warping to z8 or z6 does not show this problem.
I used these commands to do the warp:
gdalwarp -t_srs EPSG:900913 -te -18701674 2264982 -5788613 10750786 -tr
1222.992 1222.992 -r cubicspline -tps landcover-1km-to-merc.vrt z7.tif
gdalwarp -t_srs EPSG:900913 -te -18701674 2264982 -5788613 10750786 -tr
611.496 611.496 -r cubicspline -tps landcover-1km-to-merc.vrt z8.tif
Possible Bug #2: Misregistered gdalwarp output from VRT.
I figured that I could cut tiles from a non-blocky, zoom=8 spherical mercator
image. Thanks to the ground control points in the VRT and visual evidence from
the tiles I've been working with, I assumed that simply running gdalwarp would
result in a correctly-registered output file. However, when I took the zoom=8
TIFF generated above and tiled it, I was seeing the area around San Francisco
projected too far north by about 20km, and the area around New York too far
south by about 10-20km. The whole map appeared to have been rotated or
distorted. Why would gdalwarp be unable to create a correctly-registered image
that the python bindings seemingly had no trouble with?
I realize this is a big question, and I hope that the various provided files
help.
-mike.
----------------------------------------------------------------
michal migurski- [email protected]
415.558.1610
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev