[gdal-dev] problems with gdal reprojection (from pixel to latitude/longitude)

B.O benedetta.onori at gmail.com
Wed Feb 27 06:23:31 PST 2013


I have a satellite images of this type (link to example:
http://navigator.eumetsat.int/smartEditor/preview/msg-level-1-5.jpg). I have
to reproject the image to obtain latitude and longitude values for every
pixel. I use gdal library (http://www.gdal.org/), and I follow some public
example. The problem is that longitude and latitude values do not corrispond
to real values that i suppose...
I link a short version of my code. I do not use class GDALDataset because I
have geotransform matrix yet (values are g0, g1, g2, g3, g4, g5).


OGRSpatialReference *poSRS_Proj = new OGRSpatialReference("WGS84");
poSRS_Proj->importFromEPSG( 4326 );
// Define Geographic coordinate system - set it to WGS84.
OGRSpatialReference *poSRS_Geog = new OGRSpatialReference("WGS84");
poSRS_Geog->importFromEPSG( 4326 ); // WGS84
// Set up the coordinate transform (projected-to-geographic).
OGRCoordinateTransformation *poCT_Proj2Geog;
poCT_Proj2Geog = OGRCreateCoordinateTransformation( poSRS_Proj, poSRS_Geog
);

double lats = g3 + g4 * (row_pixel) + g5 * (column_pixel); 
double lons = g0 + g1 * (row_pixel) + g2 * (column_pixel);

double lat0 = lats;
double lon0 = lons;
// Projected coordinates to latlon
poCT_Proj2Geog->Transform(1, &lat0, &lon0);


Outputs are: latitude = 1.06815e+06, longitude = -1.06815e+06.
I tried several values for row_pixel and column_pixel but i get always the
same problem.
Can someone help me???? Thanks!



--
View this message in context: http://osgeo-org.1560.n6.nabble.com/problems-with-gdal-reprojection-from-pixel-to-latitude-longitude-tp5037268.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list