#10115 closed defect (fixed)
Coordinates near zero meridian are saved in scientific notation
Reported by: | 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)
Change History (12)
comment:1 by , 10 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 10 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
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)
by , 10 years ago
Attachment: | latlon_format.patch added |
---|
comment:6 by , 10 years ago
Milestone: | → 14.06 |
---|
comment:7 by , 10 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
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.
follow-up: 9 comment:8 by , 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 likeif (abs(lon)<0.1 /*adv. parameter*/)) {use 9 digits}
)
follow-up: 11 comment:9 by , 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:11 by , 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).
Yes, this is perfectly correct. JOSM can open these files without any problem later.