Repository navigation
accept coordinates as input - #142
Conversation
|
Yes, maybe if it is a parsable coordinate we just ignore the autocomplete list. (currently this is how it works in old GH Maps). But maybe additionally stop doing geocoding if it is a parsing coordinate does not hurt too (I know there are some different address systems not using street names in e.g. Japan but don't know how this works exactly and if this would make a problem here). What do you think @easbar ? |
|
I just tried it for So I think as soon as we have two numbers separated by a comma (and no letters) it should use the input as coordinates when pressing Enter or Tab. (It would be nice if geocoding is not done in those cases, but maybe not required as a first version here.) |
| } | ||
|
|
||
| export function textToCoordinate(text: string): Coordinate { | ||
| const split = text.split(/[,|;| |-|\/]/) |
There was a problem hiding this comment.
Shouldn't it be splitted only for , and space?
There was a problem hiding this comment.
I thought: Why not be tolerant regarding formatting. But comma and space are also fine with me
There was a problem hiding this comment.
For now I would be more strict as we would forcefully pick this instead of the suggestion (we could later relax this a bit if required).
But especially the minus needs to go into the number as the coordinate can get negative too.
There was a problem hiding this comment.
I see. I will change it to comma and space then.
Add test for converter don't throw errors but null from converter if a string is passed which is not a coordinate
|
Thank you - this works! |
* accept coordinates as input * do geocoding only if not a coordinate. Add test for converter don't throw errors but null from converter if a string is passed which is not a coordinate
fixes #114
So, it is possible to enter lat lng coordinates now. They are only accepted when there is no auto suggestion present. It is kind of hard though to find coordinates which don't have any geocoding results.
What should be the behavior here @karussell? Maybe check whether a value can be parsed as coordinate and only fetch geocoding results if not? Or fetch geocoding results in any case but only select the first item of the list if the entered text can't be parsed as a coordinate?