[gdal-dev] Correct gdalwarp usage from UTM to Equidistant Cylindrical Projection

Frank Warmerdam warmerdam at pobox.com
Tue Jul 15 20:09:06 EDT 2008


Christopher Hunt wrote:
>> Upper left corner Latitude: 52.09038 (52∞ 5' 25")
>> Upper left corner Longitude: -1.39985 (-1∞ 23' 59")
>> Lower right corner Latitude: 50.83562 (50∞ 50' 8")
>> Lower right corner Longitude: 0.47438 (0∞ 28' 28")
>>
>> Geo-reference Information: 
>> Projection: UTM Zone 30
>> Datum: WGS 84
>> Image Units: Meters
> 
> Furthermore, here's the associated tfw file contents:
> 
>> 45.000000
>> 0.000000
>> 0.000000
>> -45.000000
>> 609626.000120
>> 5772299.000249

Christopher,

This world file gives consistent locations for the upper left
corner.  I didn't try the bottom right corner, but how did you
come up with 45 meter pixels when the metadata indicated
"Native Resolution: 15" which I might guess to mean 15m pixels?


> FInally here's the command I think I should be using:
> 
>> gdalwarp -s_srs '+proj=utm +zone=30 +datum=WGS84 +x_0=609626.000120 
>> +y_0=5772299.000249' -t_srs '+proj=eqc' -dstalpha -multi 
>> 169460-65786.tif out.tif

Please, always use datum definitions when using PROJ.4 style strings.
So the -t_srs argument would be '+proj=eqc +datum=WGS84'.  It likely
doesn't matter, but it makes my skin crawl not to have this specified.

> I certainly get a resultant image but I'm not experienced enough with 
> cartography to understand whether the image is correct.
> 
> One thing that does confuse me slightly is that the centre lat/long in 
> the resultant image is not the same as in the source image... I would 
> have expected that they would be, or at least that the top left corner 
> (which is what I thinking the northerly and easterly parameters point 
> to) should be the same.

The center and top left should be similar, but need not be exactly
the same.  The UTM image will have a non-rectangular shape in a
different projection and so the region of the output image will be
somewhat larger than the original image (to contain the odd shape).
This will have some effect on corners and center.  But the differences
should be modest.

> Another thing: I would expect to specify either a scale, a resolution or 
> the other corner of the image... do I need to include something more in 
> the command for this?

The gdalwarp command will default to creating the output image with a
similar pixel size to the source image.  But you can specify a particular
pixel size or extents if you want fine control.

It would have been interesting if you could have included the gdalinfo
report for the output file so we could easily compare the region to the
region described in your metadata.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the gdal-dev mailing list