Christoph Eckert | 11 May 2011 23:49
Picon
Favicon

[MoNav Dev] Precision of UnsignedCoordinate::ToGPSCoordinate()

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

(Continue reading)

Christian Vetter | 12 May 2011 00:00
Picon

Re: [MoNav Dev] Precision of UnsignedCoordinate::ToGPSCoordinate()

Hi,

On Wed, May 11, 2011 at 11:49 PM, Christoph Eckert <ce <at> christeck.de> wrote:
> 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;

The reduced accuracy is only caused by the output. qDebug outputs with
a default accuracy of 6 digits ( including  the ones before the
decimal point ).  So you have to increase the floating point accuracy
of whatever output functions you are using. I do believe that qDebug
cannot be modified to output with increased accuracy. However, you can
use QString().arg(...) (
http://doc.qt.nokia.com/latest/qstring.html#arg-20 ).

UnsignedCoordinate itself should be accurate to at least 4cm ( worst
accuracy on the equator ). The conversion from GPS to
ProjectedCoordinate transforms the coordinate into the Mercator
projection used by OSM, x in [0,1], y in [0,1]. This is beneficial
(Continue reading)

Christoph Eckert | 12 May 2011 00:15
Picon
Favicon

Re: [MoNav Dev] Precision of UnsignedCoordinate::ToGPSCoordinate()

Hi,

> The reduced accuracy is only caused by the output. qDebug outputs with
> a default accuracy of 6 digits ( including  the ones before the
> decimal point ).  So you have to increase the floating point accuracy
> of whatever output functions you are using.

I've seen this in the tracklog, using QString::number(). Increasing its 
precision to 6 digits only gave me additional 0's. Based on your hint, I'll 
try anew. In case the problem persists, I'll come back with some more details.

BTW: I've added a first german translation to the uing branch. Except for some 
minor hickups, it looks great on the N900 and the desktop so far.

Gn8,

ce

Christoph Eckert | 13 May 2011 23:07
Picon
Favicon

Re: [MoNav Dev] Precision of UnsignedCoordinate::ToGPSCoordinate()

Hi,

> The reduced accuracy is only caused by the output. qDebug outputs with
> a default accuracy of 6 digits ( including  the ones before the
> decimal point ).  So you have to increase the floating point accuracy
> of whatever output functions you are using. I do believe that qDebug
> cannot be modified to output with increased accuracy. However, you can
> use QString().arg(...) (
> http://doc.qt.nokia.com/latest/qstring.html#arg-20 ).

thanks a bunch for the pointer. Of course "it was all my fault" - the 
precision obviously went down as I had the device on my desk…

Outdoors, either of the following provide the desired results:
double latitude = m_gpsInfoBuffer.at(i).position.ToGPSCoordinate().latitude;

std::cout.precision( 6 );
cout << latitude;

QString::number( latitude, 'f', 6 )

I apologize for the traffic, but at least we now have more accurate logging for 
MoNav :) .

--

-- 
Beste Grüße,
Best regards,

ce

(Continue reading)

Christian Vetter | 14 May 2011 03:22
Picon

Re: [MoNav Dev] Precision of UnsignedCoordinate::ToGPSCoordinate()

Hi,

Glad that's fixed. I already fell into that trap several times myself
when coding GPS loggers.

Regards,

Christian Vetter

On Fri, May 13, 2011 at 11:07 PM, Christoph Eckert <ce <at> christeck.de> wrote:
> Hi,
>
>> The reduced accuracy is only caused by the output. qDebug outputs with
>> a default accuracy of 6 digits ( including  the ones before the
>> decimal point ).  So you have to increase the floating point accuracy
>> of whatever output functions you are using. I do believe that qDebug
>> cannot be modified to output with increased accuracy. However, you can
>> use QString().arg(...) (
>> http://doc.qt.nokia.com/latest/qstring.html#arg-20 ).
>
> thanks a bunch for the pointer. Of course "it was all my fault" - the
> precision obviously went down as I had the device on my desk…
>
> Outdoors, either of the following provide the desired results:
> double latitude = m_gpsInfoBuffer.at(i).position.ToGPSCoordinate().latitude;
>
> std::cout.precision( 6 );
> cout << latitude;
>
> QString::number( latitude, 'f', 6 )
(Continue reading)


Gmane