[Gdal-dev] Assign or define projection

Frank Warmerdam warmerdam at pobox.com
Tue Feb 28 13:58:56 EST 2006


Andy Bunn wrote:
> Gdal-helpers:
> 
> If I have an image with no projection, what is the simplest way to assign a
> projection to it? Can I do it without making a new file? An example is below
> but the summary is, given image foo.tif that has no projection info is the
> best way to assign/define the projection using:
> 
> gdalwarp -s_srs "WGS84" -t_srs "WGS84" foo.tif bar.tif

Andy,

The following command will do something similar to the above more
efficiently.

gdalwarp -a_srs WGS84 foo.tif bar.tif

At the API or scripting level you can use the SetProjection() method to
assign a projection to an existing file.  In the case of TIFF this will
cause a new directory to be written on close, wasting a bit of space.
But this approach may be worthwhile if you want to avoid copying the
original image data.

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    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list