[gdal-dev] Downsample with averaging?

Chaitanya kumar CH chaitanya.ch at gmail.com
Tue Feb 22 03:03:06 EST 2011


Jay,

The external overview files are created in TIFF format. I checked. However,
most of the metadata will be lost.
You can recover the metadata by using gdal_translate with "-outsize 3.125%
3.125%". It will read the metadata from the original file and the pixels
from the level 32 overview.

Regarding the 2.1GB file:
Check if the directory is not read-only and the disk has sufficient space.
Run gdaladdo with the environment variable CPL_DEBUG set to YES and report
the messages.

You can also try gdalwarp multiple times with the resampling method set to
something other than 'near' and 'bilinear'. However, I am not sure if this
will give you want you want.

On Tue, Feb 22, 2011 at 4:26 AM, Jay Jennings <Jennings.Jay at geoeye.com>wrote:

> Unfortunately I can’t provide the file (it’s about 2.1 GB and not
> releasable), but below is the ‘gdalinfo’ dump for it.
>
>
>
> The problem may be related to size of the input, because the same command
> worked OK on a GeoTiff that is “only” 975 MB.
>
>
>
> BTW   For the 975 GB run that succeeded, the created overview was named
> *.ovr rather than *.tif.   Is this expected ?   The guidance for ‘gdaladdo’
> hints that the created *.ovr is actually a TIFF, but that’s not true here (I
> tried renaming it *.tif, but no TIFF reader could open it).
>
>
>
>
>
> Driver: GTiff/GeoTIFF
>
> Files: XXXXXX.tif
>
> Size is 25733, 27840
>
> Coordinate System is:
>
> GEOGCS["WGS 84",
>
>     DATUM["WGS_1984",
>
>         SPHEROID["WGS 84",6378137,298.257223563,
>
>             AUTHORITY["EPSG","7030"]],
>
>         AUTHORITY["EPSG","6326"]],
>
>     PRIMEM["Greenwich",0],
>
>     UNIT["degree",0.0174532925199433],
>
>     AUTHORITY["EPSG","4326"]]
>
> Origin = (-100.375165330488004,29.624901844319002)
>
> Pixel Size = (0.000004869286704,-0.000004495684143)
>
> Metadata:
>
>   TIFFTAG_DATETIME=2009:07:17 06:16:07
>
>   TIFFTAG_ARTIST=GeoEye
>
>   TIFFTAG_COPYRIGHT=(C) COPYRIGHT GeoEye, All Rights Reserved
>
>   TIFFTAG_MINSAMPLEVALUE=0
>
>   TIFFTAG_MAXSAMPLEVALUE=255
>
>   AREA_OR_POINT=Area
>
> Image Structure Metadata:
>
>   INTERLEAVE=PIXEL
>
> Corner Coordinates:
>
> Upper Left  (  -100.3751653,  29.6249018) ( 100d22'30.60"W, 29d37'29.65"N)
>
> Lower Left  (  -100.3751653,  29.4997420) ( 100d22'30.60"W, 29d29'59.07"N)
>
> Upper Right (  -100.2498639,  29.6249018) ( 100d14'59.51"W, 29d37'29.65"N)
>
> Lower Right (  -100.2498639,  29.4997420) ( 100d14'59.51"W, 29d29'59.07"N)
>
> Center      (  -100.3125146,  29.5623219) ( 100d18'45.05"W, 29d33'44.36"N)
>
> Band 1 Block=512x512 Type=Byte, ColorInterp=Red
>
> Band 2 Block=512x512 Type=Byte, ColorInterp=Green
>
> Band 3 Block=512x512 Type=Byte, ColorInterp=Blue
>
>
>
> *From:* Chaitanya kumar CH [mailto:chaitanya.ch at gmail.com]
> *Sent:* Monday, February 21, 2011 4:19 PM
> *To:* Jay Jennings
> *Cc:* gdal-dev at lists.osgeo.org
> *Subject:* Re: [gdal-dev] Downsample with averaging?
>
>
>
> Jay,
>
> Can you provide a sample file that gives this error?
>
> On Tue, Feb 22, 2011 at 1:56 AM, Jay Jennings <Jennings.Jay at geoeye.com>
> wrote:
>
> Hello list,
>
> (using GDAL 1.8.0) I am trying to create a 32:1 down-sampled overview of a
> GeoTiff satellite image.  My first thought was gdal_translate, with args
> such as “-outsize 3.125% 3.125%”… which produces surprisingly high quality
> given the absence of a resampling option.   However I’m looking for a
> downsampling scheme that creates a result pixel by averaging all relevant
> source pixels (I know, for 32:1 downsample, that means 1024 source pixels
> for each result pixel !) with the hope of an output that is not “speckled”
> or “grainy” insofar as possible.
>
>
>
> I also looked at gdaladdo, which does have the “-r average” resampling
> option… the guidance at gdal.org seems to suggest that it can produce a
> 32:1 GeoTIFF external overview with a command like this:
>
>
>
> gdaladdo  -r  average  -ro  XXXXX.tif  32
>
>
>
> But that produces a surprising error message, namely:
>
> ERROR 4: `XXXXX.tif.ovr' does not exist in the file system, and is not
> recognised as a supported dataset name.
>
>
>
> Am I barking up the wrong tree with gdaladdo for this purpose ?  Anybody
> have any suggestions for highest-quality down-sampling ? Thanks in advance.
>
>
>
> --Jay Jennings
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
>
>
> --
> Best regards,
> Chaitanya kumar CH.
> /tʃaɪθənjə/ /kʊmɑr/
> +91-9494447584
> 17.2416N 80.1426E
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>



-- 
Best regards,
Chaitanya kumar CH.
/tʃaɪθənjə/ /kʊmɑr/
+91-9494447584
17.2416N 80.1426E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110222/da4ccae3/attachment.html


More information about the gdal-dev mailing list