[gdal-dev] merging of files with gdalwarp causses a slight shift

2011-09-06 Thread Etienne Tourigny
Hi All,

Merging 2 files with a geographical CRS results in the output being shifted
a quarter-pixel to the east and south.  The datum is WGS84 (altough not
explicitly named), I get the same result if I explicitly set it to WGS84.
SImilar data in modis sinusoidal projection gets merged fine with the same
command.

I am using the following command:
gdalwarp -srcnodata 0 -dstnodata 0 -co COMPRESS=LZW
MCD45monthly.burndate.Win06.2010-byte.tif
MCD45monthly.burndate.Win05.2010-byte.tif
MCD45monthly.burndate.sam.2010-Byte.tif

Files can be found at:
http://www.openclimgeo.org/pub/


Any help would be appreciated! Here is the gdalinfo for the 3 files.

Etienne

tourigny@supernova: /data/research/work/modis/mcd45/gtiff/out/upload $
gdalinfo MCD45monthly.burndate.Win05.2010-byte.tif
Driver: GTiff/GeoTIFF
Files: MCD45monthly.burndate.Win05.2010-byte.tif
Size is 10923, 5234
Coordinate System is:
GEOGCS[,
DATUM["unknown",
SPHEROID["unnamed",6378137,298.257223563]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433]]
Origin = (-81.997802734374957,12.997802734374995)
Pixel Size = (0.00439453125,-0.00439453125)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  ( -81.9978027,  12.9978027) ( 81d59'52.09"W, 12d59'52.09"N)
Lower Left  ( -81.9978027, -10.0031738) ( 81d59'52.09"W, 10d 0'11.43"S)
Upper Right ( -33.9963379,  12.9978027) ( 33d59'46.82"W, 12d59'52.09"N)
Lower Right ( -33.9963379, -10.0031738) ( 33d59'46.82"W, 10d 0'11.43"S)
Center  ( -57.9970703,   1.4973145) ( 57d59'49.45"W,  1d29'50.33"N)
Band 1 Block=10923x1 Type=Byte, ColorInterp=Gray
  NoData Value=0
tourigny@supernova: /data/research/work/modis/mcd45/gtiff/out/upload $
gdalinfo MCD45monthly.burndate.Win06.2010-byte.tif
Driver: GTiff/GeoTIFF
Files: MCD45monthly.burndate.Win06.2010-byte.tif
Size is 10240, 5689
Coordinate System is:
GEOGCS[,
DATUM["unknown",
SPHEROID["unnamed",6378137,298.257223563]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433]]
Origin = (-78.997802734374972,-10.002197265624996)
Pixel Size = (0.00439453125,-0.00439453125)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  ( -78.9978027, -10.0021973) ( 78d59'52.09"W, 10d 0' 7.91"S)
Lower Left  ( -78.9978027, -35.0026855) ( 78d59'52.09"W, 35d 0' 9.67"S)
Upper Right ( -33.9978027, -10.0021973) ( 33d59'52.09"W, 10d 0' 7.91"S)
Lower Right ( -33.9978027, -35.0026855) ( 33d59'52.09"W, 35d 0' 9.67"S)
Center  ( -56.4978027, -22.5024414) ( 56d29'52.09"W, 22d30' 8.79"S)
Band 1 Block=10240x1 Type=Byte, ColorInterp=Gray
  NoData Value=0
tourigny@supernova: /data/research/work/modis/mcd45/gtiff/out/upload $
gdalinfo MCD45monthly.burndate.sam.2010-Byte.tif
Driver: GTiff/GeoTIFF
Files: MCD45monthly.burndate.sam.2010-Byte.tif
Size is 10923, 10923
Coordinate System is:
GEOGCS[,
DATUM["unknown",
SPHEROID["unnamed",6378137,298.257223563]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433]]
Origin = (-81.997802734374957,12.997802734374995)
Pixel Size = (0.00439453125,-0.00439453125)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  ( -81.9978027,  12.9978027) ( 81d59'52.09"W, 12d59'52.09"N)
Lower Left  ( -81.9978027, -35.0036621) ( 81d59'52.09"W, 35d 0'13.18"S)
Upper Right ( -33.9963379,  12.9978027) ( 33d59'46.82"W, 12d59'52.09"N)
Lower Right ( -33.9963379, -35.0036621) ( 33d59'46.82"W, 35d 0'13.18"S)
Center  ( -57.9970703, -11.0029297) ( 57d59'49.45"W, 11d 0'10.55"S)
Band 1 Block=10923x1 Type=Byte, ColorInterp=Gray
  NoData Value=0
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] merging of files with gdalwarp causses a slight shift

2011-09-06 Thread Frank Warmerdam

On 11-09-06 06:05 PM, Etienne Tourigny wrote:

Hi All,

Merging 2 files with a geographical CRS results in the output being shifted a
quarter-pixel to the east and south.  The datum is WGS84 (altough not
explicitly named), I get the same result if I explicitly set it to WGS84.
SImilar data in modis sinusoidal projection gets merged fine with the same 
command.

I am using the following command:
gdalwarp -srcnodata 0 -dstnodata 0 -co COMPRESS=LZW
MCD45monthly.burndate.Win06.2010-byte.tif
MCD45monthly.burndate.Win05.2010-byte.tif 
MCD45monthly.burndate.sam.2010-Byte.tif

Files can be found at:
http://www.openclimgeo.org/pub/


Any help would be appreciated! Here is the gdalinfo for the 3 files.


Etienne,

As far as I can see the two input files (Win05 and Win06) are not sampled
on the same grid even though they have the same pixel size.  For instance
comparing the offsets of the top left X positions we see they are not an
even number of pixels apart:

>>> (-81.997802734374957 - -78.997802734374972) / 0.00439453125
-682.666345

When gdalwarp creates the output file it picks an extent and pixel size
to capture all the input files and preserve essentially the same pixel
size.  In this case the pixel size seems to be preserved but by definition
the sampling grid can't match both files so one ends up being resampled.

So, things are "working as intended".

Best regards,
--
---+--
I set the clouds in motion - turn up   | Frank Warmerdam, warmer...@pobox.com
light and sound - activate the windows | http://pobox.com/warmerda
and watch the world go round - Rush| Geospatial Software Developer

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] merging of files with gdalwarp causses a slight shift

2011-09-07 Thread Etienne Tourigny
Thanks Frank!

I just noticed that in the resulting file, the contents of the first
file are not shifted, whereas the contents of the second file only are
shifted. Not what I would like but certainly correct, considering the
input files.

regards,
Etienne
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev