[Gdal-dev] Error Message with gdalwarp

Manuel Massing m.massing at warped-space.de
Tue Oct 12 09:30:10 EDT 2004


Hi Todd,

> Sorry but I am new to this stuff. Why do I want to use gdal_translate
> instead of gdal_warp? I want to be able to input a min and max of
> latitude and longitude, and I do not see where gdal_translate will allow
> this. Also, where do I put that file you sent me? Does it go in the
> gcore folder? Thanks.

No, this is a standalone utility, you just need to have gdal in the 
include/link path of your C++ compiler. Assuming you do not have a C++
compiler set up, you can find the appropriate pixel coordinates by hand
(one pixel covers 1/120 deg in the mentioned dataset):

 x_pixel = (desired_longitude+180)*120
 y_pixel = (desired_lattitude+90)*120

 x_size = long_extent*120
 y_size = lat_extent*120

Then: gdal_translate -srcwin <x_pixel> <y_pixel> <x_size> <y_size> western.tif 
output.tif

For georeferenced files, you can use -projwin instead of -srcwin.

hth,

 Manuel



More information about the Gdal-dev mailing list