Modify

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#10115 closed defect (fixed)

Coordinates near zero meridian are saved in scientific notation

Reported by: oleg-secondary@… Owned by: team
Priority: normal Milestone: 14.06
Component: Core Version:
Keywords: Cc:

Description

When you save data into file, coordinates near zero meridian are stored in scientific (exponential) notation

input.osm

...
<node id="575890719" lat="41.0904062" lon="-0.0006548" version="1" timestamp="2009-11-30T12:24:13Z" changeset="3255021" uid="20587" user="balrog-kun"/>
...

1) Run JOSM
2) Open "input.osm"
3) Save as "output.osm"

output.osm

...
<node id='575890719' timestamp='2009-11-30T12:24:13Z' uid='20587' user='balrog-kun' visible='true' version='1' changeset='3255021' lat='41.0904062' lon='-6.548E-4' />
...

Attachments (1)

latlon_format.patch (1.6 KB ) - added by akks 10 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 by Don-vip, 10 years ago

Resolution: invalid
Status: newclosed

Yes, this is perfectly correct. JOSM can open these files without any problem later.

comment:2 by akks, 10 years ago

Resolution: invalid
Status: closedreopened

Hmm, I think that the problem is not in JOSM reading these files, but other instruments (on forum osmconverter and osmfilter crashes were mentioned). I think it is easier for us to fix this than make other tool-makers do it or argue about standards.

@team: What do you think about the following patch? (we had the same conversion in changeset bounds already in the same class - so there was some reason in formatting)

Last edited 10 years ago by akks (previous) (diff)

by akks, 10 years ago

Attachment: latlon_format.patch added

comment:3 by Don-vip, 10 years ago

if it works, go ahead :)

comment:4 by akks, 10 years ago

It seems to work :) Let's try...

comment:5 by akks, 10 years ago

Resolution: fixed
Status: reopenedclosed

In 7233/josm:

fix #10115: use fixed point notation for all coordinates in generated .osm

comment:6 by Don-vip, 10 years ago

Milestone: 14.06

comment:7 by bastiK, 10 years ago

Resolution: fixed
Status: closedreopened

This rounds coordinates to 1 cm. We probably need a bit more for precision, not for mainstream OSM, but side projects like indoor mapping and whatever people come up with.

comment:8 by akks, 10 years ago

The previous version also had 7 digits precision, except coords near to zero. So we have the following options:

a) Globally increase precision to 9 digits -> bigger files and traffic but possible
b) Try to tune precision based on file location (upload->7digits, local save->9)
c) Setup formatter so that for small values it will use >7 digits (smth like if (abs(lon)<0.1 /*adv. parameter*/)) {use 9 digits})


in reply to:  8 ; comment:9 by bastiK, 10 years ago

Replying to akks:

The previous version also had 7 digits precision, except coords near to zero.

No, this is wrong. Before [7233], JOSM saved 13 to 17 digits, which corresponds to full Double precision.

If you store a DataSet to file and reload it, you get the exact same coordinates, not a single bit in the double value is changed. :)

Now this was probably overkill, 10-11 digits should be enough...

comment:10 by bastiK, 10 years ago

Resolution: fixed
Status: reopenedclosed

In 7236/josm:

fixed #10115 - increase number of digits saved to file

in reply to:  9 comment:11 by akks, 10 years ago

Replying to bastiK:

Replying to akks:

The previous version also had 7 digits precision, except coords near to zero.

No, this is wrong. Before [7233], JOSM saved 13 to 17 digits, which corresponds to full Double precision.

If you store a DataSet to file and reload it, you get the exact same coordinates, not a single bit in the double value is changed. :)

Now this was probably overkill, 10-11 digits should be enough...

Your change should be OK, but the saving before [7233] was possibly system-dependent, see the examples in ticket. I have tested the patch exactly the way you described: compared saved file, loaded&saved file and file saved by tested release. Coordinates were the same.

10-11 digits should be no problem (however it will increase traffic to OSM server a little).

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.