Wrong calculated distance

2,945 views
Skip to first unread message

Jens Schärer

unread,
Dec 20, 2012, 6:57:02 AM12/20/12
to osm...@googlegroups.com

I have a problem with my OSMAND Nighly (#395) installation on my Desire Z (running Android 4.2.1 / CM10.1). The distances are calculated wrong, see screenshot below. This not only happens in routing mode but also when only showing the distance to destination point. Sometimes, when moving around without a route and given destination point, the distances changes to the correct one (saying I'm about 300 meters correctly away from destination point on map, it wanks between 300meters and 10 km). What am I doing wrong? I've done a full reset of osmand settings, I redownloaded all maps.

On my Nexus 10, I have installed same maps, same version and same favorites and there everything works fine... Please help :)



Hardy

unread,
Dec 20, 2012, 8:08:02 AM12/20/12
to osm...@googlegroups.com
Very weird, I cannot reproduce this on any of my test devices.
 
I notice that there is no position marker on your screen, could it be that there is an (intermittent) issue with your GPS fix at the time? (Do you have GPS enabled at all, Icannot identify an icon in the task bar?)

Jens Schärer

unread,
Dec 20, 2012, 8:48:10 AM12/20/12
to osm...@googlegroups.com
I've made some more screenshots. GPS is on, I also got a fix with accuracy at ~13m.

The screenshots are made with routing on and without routing, all are taken from the same place at nearly the same time. I tried to get some screenshots to illustrate the distance with right calculation and wrong calculation. The routing distance is wrong all the time. Just for info: I installed a new radio few days ago, but I didn't notice any problems using other apps using GPS. Also google maps works correctly on this. Maybe I will try another radio later.

Victor Shcherb

unread,
Dec 20, 2012, 9:03:38 AM12/20/12
to osmand
I bet something strange in the map data. If you calculate route with Only show option and press Info (route details). Where do you see the distance become very suspicious? (At what turn and what is the map interval).

Victor


2012/12/20 Hardy <hm.gg...@gmail.com>
Message has been deleted

Jens Schärer

unread,
Dec 20, 2012, 9:33:00 AM12/20/12
to osm...@googlegroups.com
Simply, the problem occurs arround the world, not only in the german map. I also tried in italy and france. I don't think it is a problem with the map data, otherwise other people also should have this problem?
I also see this problem when I use online routing instead of offline routing.

To answer your question: I've made another route and screenshot. See also screenshot of the routing details attached, which has the wrong distance. The GPX does seem to be correct (attached as zip, because google won't let me attach the zip).

wrongdistance.gpx.zip

Manfred

unread,
Dec 20, 2012, 10:47:27 AM12/20/12
to osm...@googlegroups.com
Hi Jens!

Displaying the gpx-file with GPS-Prune shows wrong-gpsprune.gif, has 47 points as seen in wrongdistance.txt and is 3,89km long.
Opening in Routeconverter, track is shown correctly, has 42 points and is 1505m long. The route has  5 route-points, and a lengths of 1826 meters.

I do not understand why, but maybe this information is helpful for somebody else.

Regards
Manfred
wrong-gpsprune.gif
wrongdistance.txt

Jens Schärer

unread,
Dec 21, 2012, 5:24:02 PM12/21/12
to osm...@googlegroups.com
Any New infos on this?

Victor Shcherb

unread,
Dec 21, 2012, 6:14:17 PM12/21/12
to osmand
I clearly something wrong. But! I have no idea what could be the reason that is only reproducible on your phone. I would start blaming Android API for calculating distance but I need everything double check. 
What is the most suspicious - it is not reproducible on different device!
--- We need to find contradiction in very simple situation that will explain everything.

I found very very weird that GPX file was written correctly! I see no difference in the code between written GPX file and the route description. But in your case it is wrong! Hm...

But one more suspicion 
    <rtept lat="49.6854149" lon="8.6158776">
      <desc>links abbiegen, dann 1,07 km</desc>
      <extensions>
        <time>2497</time>
        <turn>TL</turn>
        <turn-angle>-92.35798</turn-angle>
        <offset>10</offset>
      </extensions>
    </rtept>

The description is correct but Time is almost impossibly high. Time in the code calculated as  (int) (distance / averageSpeed).  So if distance is correct than speed is incorrect.


Anyway it still doesn't help to solve the problem. You can try to calculate route in Safe mode and with different route providers and give us results.


Victor



2012/12/21 Jens Schärer <jsdel...@googlemail.com>
Any New infos on this?

zwiebelchen89

unread,
Dec 24, 2012, 4:39:13 AM12/24/12
to osm...@googlegroups.com
Same weird distances and calculated assumed traveling time.

Got a Galaxy Nexus (maguro) with CM10.1 Nightly from 22. Dec. 2012. Reinstalled osmand (Version 1.1.0) completely and deleted / reloaded all maps / data etc (Germany / NRW).

Always wrong distance, routing service doesn't matter (wether osmand nor cloudmate is correct).

I guess GPS is working correctly, no problems with Google Maps...

Correct on Motorola Xoom (Stingray), Germany / NRW Map from 06.Oct.2012 (and with fresh maps, also), OSMAnd 1.1.0 Beta CM10 Nightly 12. Dec. 2012.

zwiebelchen89

unread,
Dec 24, 2012, 4:50:41 AM12/24/12
to osm...@googlegroups.com
BTW.:

found this:

http://mein.support.runtastic.com/runtastic-de/topics/astronomische_kilometer_werte_bei_korrektem_gps_signal

To sum it up in english: someone got same wrong, silly GPS data with the app Runtastic.
I guess the point is Android 4.2.1 because he said with Version 4.1.2, there was no problem like this.

zwiebelchen89

unread,
Dec 25, 2012, 7:06:16 PM12/25/12
to osm...@googlegroups.com
YEAH, GOT IT !!!

Seems to be an Android Bug, try the following:

Location.distanceTo(Location) is different to Location.distanceBetween(double startLatitude, double startLongitude, double endLatitude, double endLongitude, float[] results) !

Location.distanceBetween() seems to be the correct one...

James Duncan

unread,
Dec 26, 2012, 1:55:24 PM12/26/12
to osm...@googlegroups.com
Just FYI I can reproduce this bug. I'm using CM10.1 (4.2.1) on the i9300 (international/Exynos Samsung Galaxy S III) with OSMAnd+. If you have a test version, I'll check that the fix is also working on this build.

Victor Shcherb

unread,
Dec 27, 2012, 6:45:14 AM12/27/12
to osmand
Could you report this bug on CM10.1? Or is it on all Android 4.2.1. 
 Location.distanceBetween is not very handy method from API point of view it requires additional array. Of course it is doable, replacing all distance measurement to home-grown method MapUtils.getDistance, but I would like to understand whole situation. 
API bug is very critical.

Best Regards,
Victor


2012/12/26 James Duncan <jamesand...@gmail.com>

James Duncan

unread,
Dec 27, 2012, 6:48:32 AM12/27/12
to osm...@googlegroups.com
I actually have a friend with a N4 on a stock rom, so I'll ask him to test this.

If the bug doesn't reproduce then I'll file the CM bug.
--
James Duncan
"To any truly impartial person, it would be obvious that I am right."

Jens Schärer

unread,
Dec 27, 2012, 8:36:09 AM12/27/12
to osm...@googlegroups.com, jadu...@jaduncan.com
I also tried with the latest nightly OSMAND build on my nexus 10 with stock Android 4.2.1 and there everything is working fine. On my Desire Z Smartphone I have a custom rom with CM 10.1 installed, where the well-known bug occurs. So it seems to be an CM 10.1 bug. Can someone confirm this, too?

Ludovic Strappazon

unread,
Dec 29, 2012, 11:41:38 AM12/29/12
to osm...@googlegroups.com, jadu...@jaduncan.com
Hi, 

I can confirm the same bug on my Galaxy S2 I9100G and CM10.1 with Osmand, CardioTrainer, Endomondo...

I have reported the problem in the xda thread for I9100G : http://forum.xda-developers.com/showthread.php?t=2010985&highlight=gps&page=132

Regards,
L.

yrtimiD

unread,
Dec 30, 2012, 5:56:54 PM12/30/12
to osm...@googlegroups.com
Message has been deleted

zwiebelchen89

unread,
Dec 31, 2012, 9:20:12 AM12/31/12
to osm...@googlegroups.com
Oh man, something is going very wrong :-P

I tried to replace every location.distanceTo(location) with Location.distanceBetween() in osmand but still not working correctly.

I thought my suggestion could be right because I built in a debug output at RoutingHelper, Line 233 (osmand) where wrong calculation should be
detected (as a result of location.distanceTo()) and I've printed out location.distanceTo() (always wrong) and Location.distanceBetween() (mostly wright)
but after replacing all occurences of location.distanceTo() didn't fix it at all...
Message has been deleted

Jens Schärer

unread,
Jan 8, 2013, 5:57:58 AM1/8/13
to osm...@googlegroups.com
In one of the latest cm 10.1 nighly builds, the issue with wrong calculated distances is fixed. On my phone, everything works fine again. See http://code.google.com/p/cyanogenmod/issues/detail?id=6883 for more details

David White

unread,
Jan 18, 2013, 2:11:38 AM1/18/13
to osm...@googlegroups.com

Thanks for the tip Jens just upgraded to la test nightly build and home is not 4700km from work anymore!

David

Reply all
Reply to author
Forward
0 new messages