#5604 closed enhancement (fixed)
[Patch] support different formats of GPS coordinates in Add Node
Reported by: | *Martin* | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core | Version: | latest |
Keywords: | add node gps coordinate format | Cc: |
Description
My patch supports different GPS coordinate formats, for example:
49.29918° 19.24788°
N 49.29918 E 19.24788
W 49°29.918' S 19°24.788'
N 49°29'04" E 19°24'43"
49.29918 N, 19.24788 E
49°29'21" N 19°24'38" E
49 29 51, 19 24 18
49 29, 19 24
E 49 29, N 19 24
49° 29; 19° 24
N 49° 29, W 19° 24
49° 29.5 S, 19° 24.6 E
N 49 29.918 E 19 15.88
49 29.4 19 24.5
-49 29.4 N -19 24.5 W
--
*Martin*
Attachments (3)
Change History (14)
Changed 13 years ago by
Attachment: | LatLonDialog.java.patch added |
---|
comment:1 Changed 13 years ago by
Summary: | Patch: support different formats of GPS coordinates in Add Node → [Patch] support different formats of GPS coordinates in Add Node |
---|
comment:2 Changed 13 years ago by
There is a problem with localization: E.g. in German environment it initializes the text field with 0°00'00,0"N 0°00'00,0"O
which does not pass validation.
comment:3 Changed 13 years ago by
The GUI is not optimal because the user cannot guess that all these formats are supported. There are several options to fix this:
- easiest would be to add explanatory text to the dialog box. compare with "find" (Ctrl-F)
- add a combobox where it shows all formats and the top entry is "auto-detect coordinate format", which would show the current text field. This might be more work because customized gui elements for the other formats are needed.
comment:4 Changed 13 years ago by
I would go with the easiest alternative - displaying some example formats.
About localization - is there in the JOSM some class that handles cardinal direction translations? I can add more letters to regular expression unless there would be a clash.
About dot vs. comma as decimal separator - I'll add support for both.
Just for example, I live in Slovakia and I rarely (if ever) see GPS coordinates localized to Slovak language. For NSEW we would have SJVZ also would use comma as decimal separator.
I think that English naming of cardinal direction in GPS coordinates is common all over the world, but I may be wrong :-).
I also think that even if I was German, I would mostly encounter with GPS coordinates in English format. But I can be wrong again :-).
In any case my patch eats much more GPS coordinate formats in compare to currently one supported format. And this is necessary for easily doing copy-paste from the web or somewhere else without any tedious conversion.
In any case are the format hints a good idea.
comment:5 Changed 13 years ago by
It should remember the input from last time.
Please use only ASCII characters in source code, so replace special characters by escape sequence, e.g. "\u00B0" for degree sign.
You are right, International (English) format is most important, but if you put localized text as default text, is should also be possible to parse it back. :)
comment:6 Changed 13 years ago by
Added new patch (v3). New features:
- remember coordinated in Add Node dialog
- supports , as decimal separator
- supports O for East (... I know, hardcoded for adding German language support)
- escaping special characters in Java code
- added description and some examples to the Add Node dialog (please correct my English there and remove some of my too many examples)
comment:8 Changed 13 years ago by
I had to make the pattern case sensitive since degree symbol substitute "o" got mixed with localized cardinal direction "O" (German east). This limits the generality a little.
comment:9 Changed 13 years ago by
In this case you can only make case sensitive "o" for degree and "O" for German east.
comment:10 Changed 13 years ago by
Can put it on my todo list, but I'm not sure when I get round to it...
the patch