geo-coordinates-parser
Advanced tools
Comparing version 1.5.5 to 1.5.6
@@ -81,3 +81,3 @@ //function for converting coordinates from a string to decimal and verbatim | ||
if (match[6]){ | ||
ddLat += match[6]/3600; | ||
ddLat += match[6].replace(',', '.')/3600; | ||
} | ||
@@ -96,3 +96,3 @@ | ||
if (match[13]) { | ||
ddLng += match[13]/3600; | ||
ddLng += match[13].replace(',', '.')/3600; | ||
} | ||
@@ -124,3 +124,3 @@ | ||
else { | ||
throw new Error("invalid DMS coordinates format") | ||
throw new Error("invalid DMS coordinates format") | ||
} | ||
@@ -428,3 +428,3 @@ } | ||
//degrees minutes seconds with '.' as separator - gives array with 15 values | ||
var dms_periods = /(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)?\s*((?:[0-5]?[0-9])(?:\.\d{1,3})?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)?\s*((?:[0-5]?[0-9])(?:\.\d{1,3})?)?\s*(EAST|WEST|[EW])?/i; | ||
var dms_periods = /(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)?\s*((?:[0-5]?[0-9])(?:[\.,]{1}\d{1,3})?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)?\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(EAST|WEST|[EW])?/i; | ||
@@ -431,0 +431,0 @@ //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 |
@@ -14,4 +14,5 @@ //TODO These formats should throw... | ||
'27.45.34 S S 23.23.23', //invalid direction on right side | ||
'27.45.34 23.23.23 E' //no dir on one side | ||
] | ||
module.exports = failingFormats |
{ | ||
"name": "geo-coordinates-parser", | ||
"version": "1.5.5", | ||
"version": "1.5.6", | ||
"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,0 +5,0 @@ "main": "merge.js", |
@@ -277,2 +277,16 @@ //return an array of coordinate strings for testing | ||
{ | ||
verbatimCoordinates: '27.15.45.2S 18.32.53.4E', | ||
verbatimLatitude: '27.15.45.2S', | ||
verbatimLongitude: '18.32.53.4E', | ||
decimalLatitude: -27.262556, | ||
decimalLongitude: 18.548167 | ||
}, | ||
{ | ||
verbatimCoordinates: '27.15.45,2S 18.32.53,4E', | ||
verbatimLatitude: '27.15.45,2S', | ||
verbatimLongitude: '18.32.53,4E', | ||
decimalLatitude: -27.262556, | ||
decimalLongitude: 18.548167 | ||
}, | ||
{ | ||
verbatimCoordinates: 'S23.43563 ° E22.45634 °', //decimals with spaces before the symbol!! | ||
@@ -279,0 +293,0 @@ verbatimLatitude: 'S23.43563 °', |
const convert = require('./converter') | ||
const test = 'S 27.45.34 S 23.23.23' | ||
const test = '27.15.45,2S 18.32.53,4E' | ||
@@ -4,0 +4,0 @@ try{ |
59833
1178