GCWizard
GCWizard copied to clipboard
Free Map: Paste several coordinates
Example:
N 41.958750° W 091.272383°, N 34.957633° W 092.272517°, S 16.218583° E 103.802533°, N 52.656467° E 011.297583°, N 31.708900° W 097.794417°
Currently, all coordinates must be pasted separately. It makes sense, to put in several coords to the map.
The most problematic thing is to detect the coordinate delimiters. So cannot simple cut the string on the commas, for example. Because N 34,5675° is a valid coord. I have no quick idea on that, maybe somebody else?
whats about an regex (n|N|e|E|s|S|w|W)( )+[0-9]{2}°( )+ ... and so on for the different format?
Sent from MailDroid
-----Original Message----- From: MLorenz42 @.> To: S-Man42/GCWizard @.> Cc: Subscribed @.***> Sent: Di., 05 Apr. 2022 10:01 Subject: [S-Man42/GCWizard] Free Map: Paste several coordinates (Issue #1007)
Example:
N 41.958750° W 091.272383°, N 34.957633° W 092.272517°, S 16.218583° E 103.802533°, N 52.656467° E 011.297583°, N 31.708900° W 097.794417°
Currently, all coordinates must be pasted separately. It makes sense, to put in several coords to the map.
The most problematic thing is to detect the coordinate delimiters. So cannot simple cut the string on the commas, for example. Because N 34,5675° is a valid coord. I have no quick idea on that, maybe somebody else?
-- Reply to this email directly or view it on GitHub: https://github.com/S-Man42/GCWizard/issues/1007 You are receiving this because you are subscribed to this thread.
Message ID: @.***>
It already works with a huge Regex! see https://github.com/S-Man42/GCWizard/blob/2ef8eb7191f0fd867352c1144876077db44a67af/lib/logic/tools/coords/converter/dmm.dart#L49
It is much more complex than you might think. Have a look at the many supported formats (here only DMM, not mentioned DEC, DMS or even other formats):
https://github.com/S-Man42/GCWizard/blob/2.3.0/test/logic/tools/coords/converter/dmm.dart
Points, commas, with our without hemisphere indicator (like N or E). N or E before or after, with or without degree symbol, "Nord", "north" vs simple "N"... An incredible amount of variants just to show the same coordinate in only ONE format ;)
Because all can possibly contain a comma, it is not quite easy to properly define, were a coordinate really ends.
Take this input:
52 12,23 12 32,42
It could be: N 52° 12.230' E 012° 32.420'
or
N 52° E 12° AND (comma!) N 23° E 12° 32.420'
or
N 52° 12' E 23° 12' 32.42"
or... whatever. It is not even close to clear, what the input is telling ;) The reason is, that we are currently supporting such a huge variety of formats, we try to interpret as much as possible as a coordinate to be as flexible as possible. But this makes an interpretation of a string with however chained coords extremely difficult... As said, I have not really a good solution...
My first approach would be (untested!!!): Taking the current parser Regexp (let's call it A) and check if the string matches this regex:
\s*(A)\s*([,;]\s*(A))\s
meaning: Match a coordinate, following by a comma/semicolon and a new coordinate.
Don't knwo if it works... Didn't think about nasty edge cases (I really do believe, there are many of them if you'd mix different format variants...)