Modify

Opened 6 years ago

Closed 6 years ago

Last modified 6 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 6 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 6 years ago by Don-vip

Resolution: invalid
Status: newclosed

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

comment:2 Changed 6 years ago by akks

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 6 years ago by akks (previous) (diff)

Changed 6 years ago by akks

Attachment: latlon_format.patch added

comment:3 Changed 6 years ago by Don-vip

if it works, go ahead :)

comment:4 Changed 6 years ago by akks

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

comment:5 Changed 6 years ago by akks

Resolution: fixed
Status: reopenedclosed

In 7233/josm:

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

comment:6 Changed 6 years ago by Don-vip

Milestone: 14.06

comment:7 Changed 6 years ago by bastiK

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 Changed 6 years ago by akks

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})


comment:9 in reply to:  8 ; Changed 6 years ago by 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...

comment:10 Changed 6 years ago by bastiK

Resolution: fixed
Status: reopenedclosed

In 7236/josm:

fixed #10115 - increase number of digits saved to file

comment:11 in reply to:  9 Changed 6 years ago by akks

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.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.