johnnyzhangzhao / monav

Automatically exported from code.google.com/p/monav
0 stars 0 forks source link

Wrong coordinates positioning #29

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,
I'm packaging MoNav 0.2 for Debian. Using the OSM dump from [0] (but this has 
been confirmed by some other users, with different dumps, and I tried small 
subsets of [0] myself), and after preprocessing it, MoNav wrongly positions 
coordinates in the map view.

Please see the attachment: there I did choose "Catania", "City centre" -- you 
can see that Catania is really ~60km north of the position shown.

Also, but this might be unrelated, I don't get any routing at all. I tried both 
leaving the "wrong" positioning (maybe it's just a display problem?) and fixing 
the markers by clicking on the map, but the routing window never shows up. 
Reading the homepage, I infer that once source and target are chosen, it should 
automatically pop up. If this is totally unrelated, I'll be happy to file a new 
bug.

Thank you,
David

[0]: http://download.gfoss.it/osm/osm/regioni/SICILIA.osm.bz2

Original issue reported on code.google.com by d.pale...@gmail.com on 3 Jan 2011 at 5:50

Attachments:

GoogleCodeExporter commented 8 years ago
Hello

I think I have same issue with Ubuntu 10.10. For me the problem was that atof 
function in xmlreader.h was returning integer. I don't know much of coding or 
compilers so I just made my own function to return double and now the 
preprocessor is working right.

Original comment by jekkuka...@gmail.com on 5 Jan 2011 at 4:44

GoogleCodeExporter commented 8 years ago
Sorry for the late reply, I have been busy during the last few days.

That's a weird behavior you encounter there. I could not reproduce it with any 
computer available to me.

The only thing I can think of right now is that atof might be using your locale 
settings, i.e., use "," instead of "." as a decimal separator. Can you check 
what results you get for "atof( "1.5" )" and "atof( "1,5" )" or whatever your 
local settings might be?

If this can be confirmed I have to replace atof with local-independent routines 
as the OSM input always uses '.' as a separator.

Original comment by veaac.fd...@gmail.com on 5 Jan 2011 at 8:59

GoogleCodeExporter commented 8 years ago
Hello

I did some testing with clean project only main function and cstdlib and 
iostream included. atof returns 1.5 as 1.5 and 1,5 as 1. Then I added 
QApplication to includes and "QApplication app(argc, argv);" to the top of main 
function. Now atof returns 1.5 as 1 and 1,5 as 1.5.

That same happens inside MoNav's code, I think.

Original comment by jekkuka...@gmail.com on 6 Jan 2011 at 4:10

GoogleCodeExporter commented 8 years ago
$ cat foo.c 
#include <stdio.h>
#include <stdlib.h>

int main() {
    printf("1,50 → %.2f\n", atof("1,5"));
    printf("1.50 → %.2f\n", atof("1.5"));
}
$ ./a.out

1,50 → 1.00
1.50 → 1.50
$

It seems it's doing the "right" thing. However, a locale-agnostic 
implementation would be better in any case, I'd say.

Original comment by d.pale...@gmail.com on 9 Jan 2011 at 8:55

GoogleCodeExporter commented 8 years ago
(so yes, maybe it's something related to QApplication)

Original comment by d.pale...@gmail.com on 9 Jan 2011 at 8:57

GoogleCodeExporter commented 8 years ago
...and, strange, but yes, my locale has "," as decimal separator:

Compare:

$ df -h | grep sdb
/dev/sdb1             7,4G   20K  7,4G   1% /media/PHOTOSD
$ LANG=C df -h | grep sdb
/dev/sdb1             7.4G   20K  7.4G   1% /media/PHOTOSD

(sorry for the multiple comments)

Original comment by d.pale...@gmail.com on 9 Jan 2011 at 9:12

GoogleCodeExporter commented 8 years ago
Nice piece of investigative work.

Could you try whether r404 fixes the behavior?

Original comment by veaac.fd...@gmail.com on 9 Jan 2011 at 9:56

GoogleCodeExporter commented 8 years ago
I couldn't backport it to 0.2, so I checked it out. And yes, it works great :)

When will you release a new version I could package? :)

Thanks!

Original comment by d.pale...@gmail.com on 9 Jan 2011 at 10:43

GoogleCodeExporter commented 8 years ago
Works great! Thank you

Original comment by jekkuka...@gmail.com on 9 Jan 2011 at 11:26

GoogleCodeExporter commented 8 years ago

Original comment by veaac.fd...@gmail.com on 13 Jan 2011 at 11:57