[Gdal-dev] Lat/Lon to UTM conversion

Michele Sanges michele.sanges at otomelara.it
Tue Mar 22 09:27:54 EST 2005


In order to convert a geographic coordinate (lat/lon - WGS84) to a projected coordinate (UTM - NAD83), I writted the following code:


> OGRSpatialReference oUTM;
> oUTM.SetWellKnownGeogCS( "NAD83" ); // the target reference system
> OGRCoordinateTransformation *poTransform=OGRCreateCoordinateTransformation(&m_oSRS, &oUTM); // m_oSRS is the source reference system (WGS84)
 > if (poTransform == NULL)
 > 	return;
 >			
 > poTransform->Transform( 1, pfXproj, pfYproj );
 > delete poTransform;

It don't works, the Transform function returns TRUE, but the coordinate (*pfXproj,*pfYproj) remain immutate.
Moreover, how can I find the UTM zone?

Thanks.
Michele





More information about the Gdal-dev mailing list