[Gdal-dev] saving GeoTiff

Ayman Kamal kamal_jo at yahoo.com
Sat Mar 15 02:59:07 EST 2003


1.
You mentioned that
adfGeoTransform[0] =   /* top left x */
adfGeoTransform[3] =   /* top left y */

-Does top left x mean the value of longitude for top
left corner?
-Does top left y mean the value of lattitude for top
left corner?

2.
What does horizental, vertical pixel size mean?

3.
Are adfGeoTransform[2],adfGeoTransform[4] always 0?

4.
If the user doesn't give me any of these data, and
still wants me to generate a GeoTiff file out of his
faces' images for example, 
are there default values that I can supply to generate
a valid GeoTiff file?

--- Frank Warmerdam <warmerdam at pobox.com> wrote:
> Ayman Kamal wrote:
> > I want to be able to convert a "bmp" file to a
> > "GeoTiff" file.
> > 
> > I used gdal_translate to do this, but the
> resulting
> > file didn't of course contain georeferencing data.
> > 
> > Now:
> > 1. Is it possible (if I find the goereferencing
> data)
> > to give them to GDAL SDK so that GDAL can generate
> a
> > GeoTiff file with georeferencing data embeded
> inside?
> > 
> > if (1.)
> > {
> >    2. What data do I need to supply to GDAL to    
> >    accomplish this?
> >    
> >    3. What functions to use in GDAL to save such
> data 
> >    in thre resulting GeoTiff file?
> > }
> > else
> > {
> >    4. Can you help me in any means to accomoplish
> > this?
> > }
> 
> Ayman,
> 
> You need to call GDALSetGeoTransform() with the
> appropriate affine geotransform.
> Please ensure you are using a fairly recent GDAL
> (like a CVS snapshot not less
> than 3 weeks old as there were some bugs in GeoTIFF
> update-in-place in 1.1.8).
> 
> The following is a fairly minimal example.  If you
> want to write the coordinate
> system also use the GDALSetProjection() method.
> 
> #include "gdal.h"
> 
> int main()
> 
> {
>      GDALDatasetH hDS;
>      double       adfGeoTransform[6];
> 
>      GDALAllRegister();
> 
>      hDS = GDALOpen( "work.tif", GA_Update );
> 
>      adfGeoTransform[0] = 1000;  /* top left x */
>      adfGeoTransform[1] = 2.0;   /* horizontal pixel
> size */
>      adfGeoTransform[2] = 0.0;
>      adfGeoTransform[3] = 6120;  /* top left y */
>      adfGeoTransform[4] = 0.0;
>      adfGeoTransform[5] = -2.0;  /* vertical pixel
> size */
> 
>      GDALSetGeoTransform( hDS, adfGeoTransform );
> 
>      GDALClose( hDS );
> }
> 
> 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
> 
> 
> _______________________________________________
> Gdal-dev mailing list
> Gdal-dev at remotesensing.org
> http://remotesensing.org/mailman/listinfo/gdal-dev


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com



More information about the Gdal-dev mailing list