Modify

Opened 9 years ago

Closed 9 years ago

Last modified 6 years ago

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

LatLonDialog.java.patch (11.8 KB) - added by *Martin* 9 years ago.
the patch
LatLonDialog.java.2.patch (10.6 KB) - added by *Martin* 9 years ago.
FIXED PATCH (v2)
AddNode.java.patch (13.8 KB) - added by *Martin* 9 years ago.
new patch (v3)

Download all attachments as: .zip

Change History (14)

Changed 9 years ago by *Martin*

Attachment: LatLonDialog.java.patch added

the patch

comment:1 Changed 9 years ago by stoecker

Summary: Patch: support different formats of GPS coordinates in Add Node[Patch] support different formats of GPS coordinates in Add Node

Changed 9 years ago by *Martin*

Attachment: LatLonDialog.java.2.patch added

FIXED PATCH (v2)

comment:2 Changed 9 years ago by bastiK

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 9 years ago by bastiK

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 9 years ago by anonymous

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 9 years ago by bastiK

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. :)

Changed 9 years ago by *Martin*

Attachment: AddNode.java.patch added

new patch (v3)

comment:6 Changed 9 years ago by anonymous

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:7 Changed 9 years ago by bastiK

Resolution: fixed
Status: newclosed

In [3656/josm]:

applied #5604 (patch by m.zdila) - support different formats of GPS coordinates in Add Node

comment:8 Changed 9 years ago by bastiK

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 9 years ago by anonymous

In this case you can only make case sensitive "o" for degree and "O" for German east.

comment:10 Changed 9 years ago by bastiK

Can put it on my todo list, but I'm not sure when I get round to it...

comment:11 Changed 6 years ago by simon04

Ticket #5444 has been marked as a duplicate of this ticket.

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.