ianengelbrecht / geo-coordinates-parser

A Javascript function for reading a variety of coordinate formats and converting to decimal numbers. Builds on other efforts by returning the verbatim coordinates and the decimal coordinates all in one object.
MIT License
38 stars 9 forks source link

Some formats are not recognized #15

Closed zdila closed 5 months ago

zdila commented 10 months ago

For example if I copy-paste some examples from https://www.npmjs.com/package/coordinate-parser#supported-formats, eg. N40°7’22.8, W74°7’22.8".

Also for example N 48° 30,6410', E 18° 57,4583' or N 48° 30' 38,463", E 18° 57' 27,499" where the decimal separator is a comma.

ianengelbrecht commented 10 months ago

Thanks for picking these up. The first example, N40°7’22.8, W74°7’22.8", is directly from the page you indicated, but it is missing the seconds symbol for latitude, and so throws the error (the requirement is format is identifical for latitude and longitude, otherwise there may be an entry error).

For the other two example, with a comma separating the lat and long, and also operating as a decimal symbol, I'll have to look at those in the year year (I will leave the issue open). Currently the first step in the script is to split on the separator, which can be comma, before doing anything else. It doesn't specifically look to split on the comma in the middle of the string, because users might add extra space around the latitude. I'll probably have to add a handler for this specific case.

idiston commented 5 months ago

The following format is not working for me 53 16.3863,4 52.8171. I get Error: invalid coordinates format

Interestingly, though this does 50 8.2914,-5 2.4447 and so does this 50 44.3003, 0 16.4119

The only difference I can see is that the Easting is a number above 0......I tried a random easting 23 39.2178 and that failed as well

ianengelbrecht commented 5 months ago

Updated to cover these forms now from @zdila as well as @idiston.

@idiston may I ask what the source of these coordinates is? They are an unusual format, DM but with no symbols and a minus sign to indicate negative latitudes and longitudes. I had to add a new regex to catch these.