[Gdal-dev] How to convert Lat/Long -> Pixel/Line ?

Jérôme MAUPAY jmaupay at corys.fr
Thu May 15 10:12:29 EDT 2003


Sorry for that simple following question, but I really don't find the answer in the doc:

I convert a pixel/line to lat/long using the following code:

bool CoxGisGdalFile::PixelLineToLatLong(int aPixel,int aLine,double* aLat, double* aLong)
{
 // Cf http://www.remotesensing.org/gdal/class_GDALDataset.html#a8
  *aLat = mGeoTransform[3] + mGeoTransform[4] * (double)aPixel + mGeoTransform[5] * (double)aLine ;
  *aLong = mGeoTransform[0] + mGeoTransform[1] * (double)aPixel + mGeoTransform[2] * (double)aLine ;

    if( !OCTTransform(mTransform,1,aLong,aLat,NULL) )
        return false ;
    return true ;
}

But how to convert from lat/long to pixel/line ???
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20030515/82b41547/attachment.html


More information about the Gdal-dev mailing list