Satellite coordinates
Article Metadata
The following code snippet demonstrates, how to obtain coordinates of the GPS satellites, that are used for determinate current device location. Class CPositionReader can be used for obtaining coordinates of the satellites. You should:
- implement interface MPositionReaderObserver in your class
- include CPositionReader* iReader as a class member
- activate request:
iReader = CPositionReader :: NewL( this ); // new reader
iReader->ReadSatelliteInfo(); // request satellites info
And process results of reading:
void YourClass :: ReadingComplete( TPositionInfoBase& aPosInfo )
{
TPositionSatelliteInfo& info = ( TPositionSatelliteInfo& )aPosInfo;
for( TInt i = 0; i < info.NumSatellitesInView(); i++ )
{
TSatelliteData satData;
info.GetSatelliteData( i, satData );
if( satData.IsUsed() )
{
TReal azimuth = aSatData.Azimuth(),
elevation = aSatData.Elevation();
...
}
}
}
The coordinates of the satellites ( azimuth and elevation ) are presented in spherical coordinates system. This image demonstrates that indicate these coordinates:
And these formulas can be used for transform spherical coordinates to the coordinates in cartesian system:
x = cos( Azimuth ) * cos( Elevation ) * Radius;
y = sin( Azimuth ) * cos( Elevation ) * Radius;


21 Sep
2009
This article represents code snippest to obtain coordinates of the GPS satellites. The article show how we can use CPositionReader class. The code snippest contains comments to make it understandable for beginners.
This article is meant for beginners and intermediate develoers who intend to find coordinates of the GPS satellite. You can also refer Celestial Sphere for the same, it will also help you in much more detail.