Thanks for your explanation, Frank! Now it works fine On Thu, 17 Jun 2010 13:59:46 -0400 Frank Warmerdam <[email protected]> wrote:
> Alexander, > > I believe the addition of 0.5 in the above is incorrect. In the > simple, non-rotated case, all values from geoTransform[0] > to geoTransform[0] + geoTransform[1] would be on the 1st > pixel (ie. pX = 0). As you have coded it, when you are half > way across the pixel you are switching into the next one. > > Keep in mind that (geoTransform[0],geoTransform[3]) > is the top left corner of the top left pixel - not the center. > > > def pixelToMap( pX, pY, geoTransform ): > > mX, mY = applyGeoTransform( pX, pY, geoTransform ) > > return mX, mY > > Conversely, here if pX and pY are coming in as integer > rather than floating point values, then you will likely want > to add half a pixel before transforming so that you get > the geoeferenced location of the center of the pixel rather > than the upper left corner. -- Alexander Bruy _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
