[Gdal-dev] New to GDAL Utilities

Stephen Woodbridge woodbri at swoodbridge.com
Mon Jan 1 12:00:23 EST 2007

Hi all,

I found the Soviet Topo Maps and thought: Hey how hard could it be to 
stitch these together into a seamless mapserver layer. And so started my 
journey ...

I wrote some code that attempts to locate the corners of the map on the 
Soviet Topo images and then use gdal to georeference the image and clip 
the collar. Many thanks to Brent Fraser assistance and help.

I think I am missing some fundamental knowledge or concepts about 
gdal_translate and gdalwarp, that I'm hoping the list can clear up for 
me. Here is what I've done so far:

woodbri at carto:~/work/collarclip$ ./collarclip -w -v -i 
050k--h36-012-1.gif -d
Corner at:   74,   72
Corner at: 2858,   67
Corner at: 2865, 2259
Corner at:   74, 2266
getMapBBox: init=epsg:28406
   bb->ul  = (35.500000, 32.000000)
   bb->ur  = (35.750000, 32.000000)
   bb->lr  = (35.750000, 31.833333)
   bb->ll  = (35.500000, 31.833333)
projected as:
   bb->pul = (6736269.9, 3544647.9)
   bb->pur = (6759904.6, 3545222.1)
   bb->plr = (6760374.1, 3526731.5)
   bb->pll = (6736696.7, 3526158.9)

gdal_translate -gcp 74 72 6736269.9 3544647.9 -gcp 2858 67 6759904.6 
3545222.1 -gcp 2865 2259 6760374.1 3526731.5 -gcp 74 2266 6736696.7 
3526158.9 -a_srs EPSG:28405 tmp.gif tmp2.tif
Input file size is 2935, 2338
0...10...20...30...40...50...60...70...80...90...100 - done.

gdalwarp -rc -t_srs EPSG:28405 tmp2.tif tmp3.tif
:0...10...20...30...40...50...60...70...80...90...100 - done.

gdalwarp -rc -t_srs EPSG:4284 -te 35.50000000 31.83333333 35.75000000 
32.00000000 tmp3.tif tmp4.tif
Creating output file that is 3078P x 2052L.
:0...10...20...30...40...50...60...70...80...90...100 - done.

So, I think I get the gdal_translate step. This is basically 
georeferencing the image, converting it to a GeoTiff and assigning the 
source srs to the image.

I'm more confused about the two gdalwarp commands. My understanding 
(probably wrong) is that the first gdalwarp is just transforming the 
image into its projection that was assigned in the gdal_translate. This 
seems wrong because it is already in that transform so this should be a 
noop, but it warps the image into a parallelgram.

The 2nd gdalwarp, I think should be doing the collar clipping and 
transformation into geographic projection. I have tried this with and 
without the 1st gdalwarp command, but I always get a blank image as output.

The images are at:

woodbri at carto:~/work/collarclip$ gdalinfo --version
GDAL, released 2005/03/13

I would appreaciate any enlightenment you can offer.

Happy New Year,

More information about the Gdal-dev mailing list