×
Namespaces

Variants
Actions

Satellite coordinates

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: Den123 (01 May 2008)
Last edited: hamishwillee (07 Feb 2012)

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:

SphereCoords.PNG

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;
This page was last modified on 7 February 2012, at 08:27.
50 page views in the last 30 days.
×