[Gdal-dev] Newbie doubt: gdalwarp

Mateusz Loskot mateusz at loskot.net
Fri Oct 19 11:40:25 EDT 2007


om wrote:
> Mateusz Loskot wrote:
> 
>> om wrote:
>>  
>>
>>> Mateusz Loskot wrote:
>>>
>>>   
>>>> om wrote:
>>>>
>>>>
>>>>     
>>>>> Hi,
>>>>>
>>>>> How can I scale a GeoTIFF image ? I have tried gdalwarp -tr 8000 8000
>>>>> -ts 8000 8000 inputimage.tif out.tif (input image resolution is
>>>>> 5213x5613) and got the following 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.
>>>>>
>>>>> -Is it possible to scale the image using gdalwarp? or is there any
>>>>> other way I can accomplish this...
>>>>>  
>>>>>       
>>>> -tr option is related to resolution in terms of image geo-reference.
>>>> If you want to scale in terms of changing physical size of image, you
>>>> can use gdal_translate with -outsize option
>>>> (http://gdal.org/gdal_translate.html) but -outsize does not preserve
>>>> geo-reference of the image precisely. The upper left corner will
>>>> stay in
>>>> the right place but other 3 corners will get moved, as the image is
>>>> smaller or bigger after applying -outsize.
>>>>
>>>> Cheers
>>>>
>>>>
>>>>     
>>> I'm getting the same error if I use -tr option only also  :-( .
>>> Am I doing anything wrong  in the commandline option?
>>>   
>>
>> Could you give the output of gdalinfo for your raster?
>> Perhaps it's not georeferenced.
>>
>> Cheers
>>  
>>
> Hi,
> This is the gdalinfo of the raster.
> 
> Driver: GTiff/GeoTIFF
> Size is 5213, 5613
> Coordinate System is:
> GEOGCS["unnamed",
>    DATUM["unknown",
>        SPHEROID["unretrievable - using WGS84",6378137,298.257223563]],
>    PRIMEM["Greenwich",0],
>    UNIT["degree",0.0174532925199433],
>    AUTHORITY["EPSG","0"]]
> Origin = (81.874167999999997,22.500834000000001)
> Pixel Size = (0.000024297832342,-0.000022566791377)
> Metadata:
>  AREA_OR_POINT=Area
>  TIFFTAG_XRESOLUTION=100
>  TIFFTAG_YRESOLUTION=100
> Corner Coordinates:
> Upper Left  (  81.8741680,  22.5008340)
> Lower Left  (  81.8741680,  22.3741666)
> Upper Right (  82.0008326,  22.5008340)
> Lower Right (  82.0008326,  22.3741666)
> Center      (  81.9375003,  22.4375003)
> Band 1 Block=5213x1 Type=Byte, ColorInterp=Gray

First, this coordinate system definition looks strange to me.
But anyway, if you are using WGS84, then you should specify -tr and -ts
options for gdalwarp with degrees but I suppose you assume 8000 as
pixels or even meters. It won't work.

Generally, I have problems with understanding your goals.
You are saying "scaling" but there are a lot of possible scaling
operations, datatype scaling (-scale option), physical size scaling
(-outsize), resolution scaling (-tr and -ts), etc.

Also, you're replying directly to me, instead of gdal-dev.
Try to use Reply To All next time. I'm adding gdal-dev to CC in this reply.

Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net



More information about the Gdal-dev mailing list