Christoph Eckert
2011-05-11 21:49:01 UTC
Hi,
compared to Mappero, which provides lat and lon with 6 decimal digits, I get
only 4 digits for lat and 5 digits for lon from MoNav - which is a bit
inaccurate.
I have no clue whether this is caused by QGeoPositionInfoSource or my
own/MoNav's code:
const RoutingLogic::GPSInfo& gpsInfo = RoutingLogic::instance()->gpsInfo();
qDebug() << gpsInfo.position.x << gpsInfo.position.y;
qDebug() << gpsInfo.position.ToGPSCoordinate().latitude \
<< gpsInfo.position.ToGPSCoordinate().longitude;
results in something like
561900976 368759099
48.9973 8.39198
561900931 368759164
48.9973 8.39197
561900925 368759161
48.9973 8.39197
561900891 368759111
48.9973 8.39195
561900852 368759081
48.9973 8.39194
561900862 368759041
48.9973 8.39194
From coordinates.h:
/** converts to GPS coordinate */
GPSCoordinate ToGPSCoordinate() const
{
return ToProjectedCoordinate().ToGPSCoordinate();
}
/** converts to floating point coordinate */
ProjectedCoordinate ToProjectedCoordinate() const
{
ProjectedCoordinate tile;
if ( !IsValid() )
return tile;
tile.x = x;
tile.y = y;
tile.x /= ( 1u << 30 );
tile.y /= ( 1u << 30 );
return tile;
}
/** converts into a GPS position */
GPSCoordinate ToGPSCoordinate() const
{
GPSCoordinate gps;
if ( !IsValid() )
return gps;
gps.longitude = x * 360.0 - 180;
const double n = M_PI - 2.0 * M_PI * y;
gps.latitude = 180.0 / M_PI * atan( 0.5 * ( exp( n ) - exp( -n ) )
);
return gps;
}
Admittedly I do not exactly understand what the above calculations do. In case
someone savvy could shed a little light on them, it would be much appreciated.
In case it helped to remove one item from my TODO list, even better :) .
compared to Mappero, which provides lat and lon with 6 decimal digits, I get
only 4 digits for lat and 5 digits for lon from MoNav - which is a bit
inaccurate.
I have no clue whether this is caused by QGeoPositionInfoSource or my
own/MoNav's code:
const RoutingLogic::GPSInfo& gpsInfo = RoutingLogic::instance()->gpsInfo();
qDebug() << gpsInfo.position.x << gpsInfo.position.y;
qDebug() << gpsInfo.position.ToGPSCoordinate().latitude \
<< gpsInfo.position.ToGPSCoordinate().longitude;
results in something like
561900976 368759099
48.9973 8.39198
561900931 368759164
48.9973 8.39197
561900925 368759161
48.9973 8.39197
561900891 368759111
48.9973 8.39195
561900852 368759081
48.9973 8.39194
561900862 368759041
48.9973 8.39194
From coordinates.h:
/** converts to GPS coordinate */
GPSCoordinate ToGPSCoordinate() const
{
return ToProjectedCoordinate().ToGPSCoordinate();
}
/** converts to floating point coordinate */
ProjectedCoordinate ToProjectedCoordinate() const
{
ProjectedCoordinate tile;
if ( !IsValid() )
return tile;
tile.x = x;
tile.y = y;
tile.x /= ( 1u << 30 );
tile.y /= ( 1u << 30 );
return tile;
}
/** converts into a GPS position */
GPSCoordinate ToGPSCoordinate() const
{
GPSCoordinate gps;
if ( !IsValid() )
return gps;
gps.longitude = x * 360.0 - 180;
const double n = M_PI - 2.0 * M_PI * y;
gps.latitude = 180.0 / M_PI * atan( 0.5 * ( exp( n ) - exp( -n ) )
);
return gps;
}
Admittedly I do not exactly understand what the above calculations do. In case
someone savvy could shed a little light on them, it would be much appreciated.
In case it helped to remove one item from my TODO list, even better :) .
--
Beste Grüße,
Best regards,
ce
Beste Grüße,
Best regards,
ce