[Gdal-dev] Gdalwarp resolution

Sampson, David dsampson at NRCan.gc.ca
Wed Nov 22 16:14:56 EST 2006


Frank,
 
Thanks for the suggestion for down sampling....
 
I think I am confused or trying to do too much...  this is my CLI call 
 
gdal_translate -gcp 378.19 196.43 -76.777261  45.67899 -gcp 6013.13
282.36 -76.744739  45.678655 -gcp 5890.36 7537.81 -76.745361  45.649344
-gcp 279.98 
7464.15 -76.777866  45.649679 -scale  -ot byte -a_srs EPSG:4201 -outsize
37.5% 37.5% -mo TIFFTAG_XRESOLUTION=300 -mo TIFFTAG_YRESOLUTION=300 -mo 
"Area_or_Point = Area" A38_001.tif oA38_001.tif
 
however I have the same issue as I outlined in MSG  [Gdal-dev]
Gdal_translate. Scaling, sizing, georeferencing
 
the issue that I assume that after the above I should have a
geo-referenced image. Two images side by side should overlap 60%
 
When I compare with a photo of same area processed using an older script
in Open EV the old images overlap, and the new gdal_translate images are
simply SMALLER pictures. The goal is for me to duplicate these
previously geo-refed images. Both the new and old images line up for the
Upper left corner, but then it falls apart. What happened to the other
three control points I passed it? A smaller resolution image should
occupy the same physical space, right?
 
Some other posts have asked the same question but I never find the
answer.
 
As a final product I will be using a -outsize of  25% or 66.7% whatever
resolution they come out as.
 
The solution I have come across is the following.
 
1.
gdal_translate -gcp 378.19 196.43 -76.777261  45.67899 -gcp 6013.13
282.36 -76.744739  45.678655 -gcp 5890.36 7537.81 -76.745361  45.649344
-gcp 279.98 
7464.15 -76.777866  45.649679 -scale  -ot byte -a_srs EPSG:4201  -mo
"Area_or_Point = Area" A38_001.tif oA38_001.tif
 
2.
gdalwarp -tr 0.0000116774 -0.0000082992 oA38_001.tif RoA38_001.tif
 
For this second stage I took info from gdalinfo of an image from step
one using the 67%. I passed that image through gdalwarp without options
to set the GCP's to the UL LL etc etc. I took the resolution and
multiplied in by 1.33. I guess I am not achieving a 300 dpi image after
all, but I got the file size I am looking for.
 
So these new resolution factors were passed again on the same image from
step one and it seemed to work. But it is messy and I can't evaluate
each photo.
 
The end result with this two step process is a geo-refed image that is
the same size that I am trying to duplicate and matches all four
corners.
 
Unfortunately I partialy don't realy know what all is ahppening or how I
could have predicted this outcome.
 
How can I get to the final product quicker and cleaner?
 
Did I goof somewhere along the way?
 
As usual, thanks
 
Cheers
 
===============
If you just want to downsample the image, you could try:

  gdal_translate -outsize 37.5% 37.5% in.tif out.tif

If you also want to override the resolution metadata tags (possibly
necessary to make printing software print properly) try:

  gdal_translate -outsize 37.5% 37.5% \
      -mo TIFFTAG_XRESOLUTION=300 -mo TIFFTAG_YRESOLUTION=300 \
      in.tif out.tif
========================

________________________________

From: gdal-dev-bounces at lists.maptools.org
[mailto:gdal-dev-bounces at lists.maptools.org] On Behalf Of Sampson, David
Sent: November 22, 2006 09:52
To: gdal-dev at lists.maptools.org
Subject: [Gdal-dev] Gdalwarp resolution



Hey folks, 

I am trying to move a 800 dpi to a 300 dpi image. The src image was
created using gdal_translate to assign SRS, 4 GCP's and change from
16bit to 8bit image. Src image has the following meta_tags

Metadata: 
  AREA_OR_POINT=Area 
  TIFFTAG_XRESOLUTION=800 
  TIFFTAG_YRESOLUTION=800 
  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch) 
  Area_or_Point =Area 


The command line I am using is: 

gdalwarp -tr 300 300 oA38_001.tif S_A38_001.tif 

But I get this error 

Creating output file that is 0P x 0L. 
ERROR 1: Attempt to create 0x0x1 TIFF file, but width, height and bands
must be positive. 

Any ideas? 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20061122/0093a2b4/attachment.html


More information about the Gdal-dev mailing list