Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand validation for lat/long coordinates #1150

Closed
smohiuddin opened this issue Oct 11, 2019 · 4 comments
Closed

Expand validation for lat/long coordinates #1150

smohiuddin opened this issue Oct 11, 2019 · 4 comments

Comments

@smohiuddin
Copy link

Hi,

Thanks for this great library. Would like to request support for Lat/long coordinates with N,S,E,W and °

Potential examples:
26°11′N
26°11′N, 91°44′E
26°11′N 91°44′E

@rohankulshreshtha
Copy link
Contributor

Yes currently only Signed degrees format is supported.
We can add validations for DMS + compass direction formats as well.
http://www.geomidpoint.com/latlon.html
@ezkemboi @profnandaa Happy to submit a PR for this one.

@ezkemboi
Copy link
Member

@rohankulshreshtha, sure. Do that, I will do a review.
I will also read the article send and also check on @smohiuddin issue on the same and provide more clarification.

I don't know what @profnandaa think?

@profnandaa
Copy link
Member

Sounds good, perhaps this should come with an extra options param to support that. Just create a new regex for that as opposed to combining both regexes in to one.

@rohankulshreshtha
Copy link
Contributor

I have added a PR for this one (#1158 ).
As discussed I have made a separate regex and introduced an option ({checkDMS : true}).
Latitudes, Longitudes range from 0 to 90, 0 to 180 respectively.
Minutes & Seconds range from 0-60.
N, S, E or W as last character(case insensitive).
Seconds can be a float.
Ex - '40° 26′ 46″ N, 79° 58′ 56″ W' or '40° 26′ 45.9996″ N, 79° 58′ 55.2″ E'
Please let me know if any change is required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants