[gdal-dev] How Can I gdalwarp From One Image to a Larger Spatial Area While Leaving Missing Data Blank in the Destination?

Peter Willis pwillis at aslenv.com
Wed Feb 5 08:30:54 PST 2014


Hello,

Thank you Jukka, that worked.
I just shifted the coordinate of the origin to another location and
everything worked.

Peter

-----Original Message-----
From: gdal-dev-bounces at lists.osgeo.org
[mailto:gdal-dev-bounces at lists.osgeo.org] On Behalf Of Jukka Rahkonen
Sent: February-05-14 5:03 AM
To: gdal-dev at lists.osgeo.org
Subject: Re: [gdal-dev] How Can I gdalwarp From One Image to a Larger
Spatial Area While Leaving Missing Data Blank in the Destination?

Peter Willis <pwillis <at> aslenv.com> writes:

> 
> Hello,
> 
> Sorry about the title but it's a bit of a bear finding answers if the 
> headers don't show the actual topic.
> But I digress.
> 
> My Issue:
> I have an input image that covers coordinates 0,0 to 450,350 UTM zone 
> 13 North and the pixel size is 1 meter.
> 
> I want to mosaic pixels 0,0 to 25,25 into a coverage of UTM 
> coordinates
> -25,-25 : 25, 25 at the output in 1 meter pixels.
> This should show a 25x25 square portion of the image in one corner of 
> the
> 50x50 output image.
> 
> 'gdal_translate' will not do this because  -25,-25  are outside the 
> bounds of the original image.
> 
> I have tried the following with gdalwarp:
> 
> gdalwarp -overwrite -te -25 -25 25 25 -tr 1 1  ./input.tif 
> ./output.tif
> 
> This does not work. I get the following error:
> 
> ERROR 1: Unable to compute a transformation between pixel/line and 
> georeferenced coordinates for ./input.tif.
> There is no affine transformation and no GCPs.
> 
> There is geography applied to the input file.
> 
> What am I doing wrong ?

Hi,

This is funny. GDAL seems not to believe in images with origo at 0,0.
I tested with some dummy png file
gdal_translate -of gtiff -co tfw=yes -co profile=baseline test.png test.png
test.tif Input file size is 588, 321
0...10...20...30...40...50...60...70...80...90...100 - done.

It does not create a tfw file. Now this fails gdalwarp test.tif test2.tif
ERROR 1: Unable to compute a transformation between pixel/line and
georeferenced coordinates for test.tif.
There is no affine transformation and no GCPs.

I made tfw file test.tfw by hand as
1
0
0
-1
0
0

and then this is successful
gdalwarp test.tif test2.tif
Creating output file that is 588P x 321L.
Processing input file test.tif.
0...10...20...30...40...50...60...70...80...90...100 - done.

and also what you want to do
gdalwarp -te -1000 -1000 1000 1000  test.tif testi3.tif Creating output file
that is 2000P x 2000L.
Processing input file test.tif.
0...10...20...30...40...50...60...70...80...90...100 - done.

So I feel there is a bug if corner coordinates are 0,0. Please verify with a
handwritten tfw file and images with origo at, let's say, 1,1.

-Jukka Rahkonen-



> Thanks for any help.
> 
> Peter
> 




_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev




More information about the gdal-dev mailing list