geo-coordinates-parser 1.5.3 → 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/converter.js +6 -1
- package/package.json +1 -1
- package/testFormats.json +14 -0
- package/testIndividual.js +1 -1
- package/testformats.js +14 -0
package/converter.js
CHANGED
@@ -409,11 +409,16 @@ function coordsCloseEnough(coordsToTest) {
|
|
409
409
|
}
|
410
410
|
|
411
411
|
//Coordinates pattern matching regex
|
412
|
+
|
413
|
+
//decimal degrees
|
412
414
|
var dd_re = /(NORTH|SOUTH|[NS])?[\s]*([+-]?[0-8]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(NORTH|SOUTH|[NS])?[\s]*[,/;]?[\s]*(EAST|WEST|[EW])?[\s]*([+-]?[0-1]?[0-9]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(EAST|WEST|[EW])?/i;
|
415
|
+
|
413
416
|
//degrees minutes seconds with '.' as separator - gives array with 15 values
|
414
|
-
var dms_periods = /(NORTH|SOUTH|[NS])?[\ \t]*([+-]?[0-8]?[0-9])[\ \t]*(\.)[\ \t]*([0-5]?[0-9])[\ \t]*(\.)?[\ \t]*((?:[0-5]?[0-9])(?:\.\d{1,3})?)
|
417
|
+
var dms_periods = /(NORTH|SOUTH|[NS])?[\ \t]*([+-]?[0-8]?[0-9])[\ \t]*(\.)[\ \t]*([0-5]?[0-9])[\ \t]*(\.)?[\ \t]*((?:[0-5]?[0-9])(?:\.\d{1,3})?)?\s*(NORTH|SOUTH|[NS])?(?:[\ \t]*[,/;][\ \t]*|[\ \t]*)(EAST|WEST|[EW])?[\ \t]*([+-]?[0-1]?[0-9]?[0-9])[\ \t]*(\.)[\ \t]*([0-5]?[0-9])[\ \t]*(\.)?[\ \t]*((?:[0-5]?[0-9])(?:\.\d{1,3})?)?\s*(EAST|WEST|[EW])?/i;
|
418
|
+
|
415
419
|
//degrees minutes seconds with words 'degrees, minutes, seconds' as separators (needed because the s of seconds messes with the S of SOUTH) - gives array of 17 values
|
416
420
|
var dms_abbr = /(NORTH|SOUTH|[NS])?[\ \t]*([+-]?[0-8]?[0-9])[\ \t]*(D(?:EG)?(?:REES)?)[\ \t]*([0-5]?[0-9])[\ \t]*(M(?:IN)?(?:UTES)?)[\ \t]*((?:[0-5]?[0-9])(?:\.\d{1,3})?)?(S(?:EC)?(?:ONDS)?)?[\ \t]*(NORTH|SOUTH|[NS])?(?:[\ \t]*[,/;][\ \t]*|[\ \t]*)(EAST|WEST|[EW])?[\ \t]*([+-]?[0-1]?[0-9]?[0-9])[\ \t]*(D(?:EG)?(?:REES)?)[\ \t]*([0-5]?[0-9])[\ \t]*(M(?:IN)?(?:UTES)?)[\ \t]*((?:[0-5]?[0-9])(?:\.\d{1,3})?)?(S(?:EC)?(?:ONDS)?)[\ \t]*(EAST|WEST|[EW])?/i;
|
421
|
+
|
417
422
|
//everything else - gives array of 17 values
|
418
423
|
var coords_other = /(NORTH|SOUTH|[NS])?[\ \t]*([+-]?[0-8]?[0-9])[\ \t]*([•º°\.:]|D(?:EG)?(?:REES)?)?[\ \t]*,?([0-5]?[0-9](?:\.\d{1,})?)?[\ \t]*(['′´’\.:]|M(?:IN)?(?:UTES)?)?[\ \t]*,?((?:[0-5]?[0-9])(?:\.\d{1,3})?)?[\ \t]*(''|′′|’’|´´|["″”\.])?[\ \t]*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?[\ \t]*([+-]?[0-1]?[0-9]?[0-9])[\ \t]*([•º°\.:]|D(?:EG)?(?:REES)?)?[\ \t]*,?([0-5]?[0-9](?:\.\d{1,})?)?[\ \t]*(['′´’\.:]|M(?:IN)?(?:UTES)?)?[\ \t]*,?((?:[0-5]?[0-9])(?:\.\d{1,3})?)?[\ \t]*(''|′′|´´|’’|["″”\.])?[\ \t]*(EAST|WEST|[EW])?/i;
|
419
424
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "geo-coordinates-parser",
|
3
|
-
"version": "1.5.
|
3
|
+
"version": "1.5.4",
|
4
4
|
"description": "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.",
|
5
5
|
"main": "merge.js",
|
6
6
|
"scripts": {
|
package/testFormats.json
CHANGED
@@ -251,6 +251,13 @@
|
|
251
251
|
"decimalLatitude": 40.123256,
|
252
252
|
"decimalLongitude": -74.123256
|
253
253
|
},
|
254
|
+
{
|
255
|
+
"verbatimCoordinates": "18°24S 22°45E",
|
256
|
+
"verbatimLatitude": "18°24S",
|
257
|
+
"verbatimLongitude": "22°45E",
|
258
|
+
"decimalLatitude": -18.4,
|
259
|
+
"decimalLongitude": 22.75
|
260
|
+
},
|
254
261
|
{
|
255
262
|
"verbatimCoordinates": "18.24S 22.45E",
|
256
263
|
"verbatimLatitude": "18.24S",
|
@@ -299,5 +306,12 @@
|
|
299
306
|
"verbatimLongitude": "23,07771° E",
|
300
307
|
"decimalLatitude": -27.71372,
|
301
308
|
"decimalLongitude": 23.07771
|
309
|
+
},
|
310
|
+
{
|
311
|
+
"verbatimCoordinates": "27.45.34 S 23.23.23 E",
|
312
|
+
"verbatimLatitude": "27.45.34 S",
|
313
|
+
"verbatimLongitude": "23.23.23 E",
|
314
|
+
"decimalLatitude": -27.759444,
|
315
|
+
"decimalLongitude": 23.38972222
|
302
316
|
}
|
303
317
|
]
|
package/testIndividual.js
CHANGED
package/testformats.js
CHANGED
@@ -286,6 +286,20 @@ var otherFormats = [
|
|
286
286
|
verbatimLongitude: '23,07771° E',
|
287
287
|
decimalLatitude: -27.71372,
|
288
288
|
decimalLongitude: 23.07771
|
289
|
+
},
|
290
|
+
{
|
291
|
+
verbatimCoordinates: '27.45.34 S 23.23.23 E',
|
292
|
+
verbatimLatitude: '27.45.34 S',
|
293
|
+
verbatimLongitude: '23.23.23 E',
|
294
|
+
decimalLatitude: -27.759444,
|
295
|
+
decimalLongitude: 23.38972222
|
296
|
+
},
|
297
|
+
{
|
298
|
+
verbatimCoordinates: 'S 27.45.34 E 23.23.23',
|
299
|
+
verbatimLatitude: 'S 27.45.34',
|
300
|
+
verbatimLongitude: 'E 23.23.23',
|
301
|
+
decimalLatitude: -27.759444,
|
302
|
+
decimalLongitude: 23.38972222
|
289
303
|
}
|
290
304
|
]
|
291
305
|
|