geo-coordinates-parser 1.7.0 → 1.7.2

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.
@@ -2,7 +2,8 @@
2
2
  //borrowed from https://www.codegrepper.com/code-examples/javascript/javascript+converting+latitude+longitude+to+gps+coordinates
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  /**
5
- * Converts decimalCoordinates to other formats commonly used
5
+ * Converts decimalCoordinates to commonly used string formats
6
+ * Note that this will add degree and direction symbols to decimal coordinates
6
7
  * @param {string} format Either DMS or DM
7
8
  * @returns {string}
8
9
  */
@@ -10,40 +11,51 @@ function toCoordinateFormat(format) {
10
11
  if (!['DMS', 'DM', 'DD'].includes(format))
11
12
  throw new Error('invalid format specified');
12
13
  if (this.decimalCoordinates && this.decimalCoordinates.trim()) {
14
+ const parts = this.decimalCoordinates.split(',').map(x => Number(x.trim()));
15
+ const decimalLatitude = Number(parts[0]);
16
+ const decimalLongitude = Number(parts[1]);
17
+ const absoluteLatitude = Math.abs(decimalLatitude);
18
+ const absoluteLongitude = Math.abs(decimalLongitude);
19
+ const latDir = decimalLatitude > 0 ? "N" : "S";
20
+ const longDir = decimalLongitude > 0 ? "E" : "W";
21
+ let result;
13
22
  if (format == 'DD') {
14
- return this.decimalCoordinates;
23
+ result = `${absoluteLatitude}° ${latDir}, ${absoluteLongitude}° ${longDir}`;
15
24
  }
16
- const parts = this.decimalCoordinates.split(',').map(x => Number(x.trim()));
17
- let convertedLat = convert(parts[0], format, true);
18
- let convertedLong = convert(parts[1], format, false);
19
- //some custom cleaning for DMS
20
- if (convertedLat.endsWith('.0"') && convertedLong.endsWith('.0"')) {
21
- convertedLat = convertedLat.replace(/\.0"$/, '"');
22
- convertedLong = convertedLong.replace(/\.0"$/, '"');
25
+ //else we need some more things
26
+ const degreesLatitude = Math.floor(absoluteLatitude);
27
+ const degreesLongitude = Math.floor(absoluteLongitude);
28
+ const minutesLatitudeNotTruncated = (absoluteLatitude - degreesLatitude) * 60;
29
+ const minutesLongitudeNotTruncated = (absoluteLongitude - degreesLongitude) * 60;
30
+ if (format == 'DM') {
31
+ let dmMinsLatitude = round(minutesLatitudeNotTruncated, 3).toFixed(3).padStart(6, '0');
32
+ let dmMinsLongitude = round(minutesLongitudeNotTruncated, 3).toFixed(3).padStart(6, '0');
33
+ if (dmMinsLatitude.endsWith('.000') && dmMinsLongitude.endsWith('.000')) {
34
+ dmMinsLatitude = dmMinsLatitude.replace(/\.000$/, '');
35
+ dmMinsLongitude = dmMinsLongitude.replace(/\.000$/, '');
36
+ }
37
+ result = `${degreesLatitude}° ${dmMinsLatitude}' ${latDir}, ${degreesLongitude}° ${dmMinsLongitude}' ${longDir}`;
38
+ }
39
+ if (format == "DMS") {
40
+ const latMinutes = Math.floor(minutesLatitudeNotTruncated);
41
+ const longMinutes = Math.floor(minutesLongitudeNotTruncated);
42
+ let latSeconds = ((minutesLatitudeNotTruncated - latMinutes) * 60).toFixed(1).padStart(4, '0');
43
+ let longSeconds = ((minutesLongitudeNotTruncated - longMinutes) * 60).toFixed(1).padStart(4, '0');
44
+ const latMinutesString = latMinutes.toString().padStart(2, '0');
45
+ const longMinutesString = longMinutes.toString().padStart(2, '0');
46
+ // if they both end in .0 we drop the .0
47
+ if (latSeconds.endsWith('.0') && longSeconds.endsWith('.0')) {
48
+ latSeconds = latSeconds.replace(/\.0$/, '');
49
+ longSeconds = longSeconds.replace(/\.0$/, '');
50
+ }
51
+ result = `${degreesLatitude}° ${latMinutesString}' ${latSeconds}" ${latDir}, ${degreesLongitude}° ${longMinutesString}' ${longSeconds}" ${longDir}`;
23
52
  }
24
- const latDirection = parts[0] >= 0 ? " N" : " S";
25
- const longDirection = parts[1] >= 0 ? " E" : " W";
26
- return `${convertedLat + latDirection}, ${convertedLong + longDirection}`;
53
+ return result;
27
54
  }
28
55
  else {
29
56
  throw new Error('no decimal coordinates to convert');
30
57
  }
31
58
  }
32
- //assumes everything is valid...
33
- function convert(coord, format) {
34
- const absolute = Math.abs(coord);
35
- const degrees = Math.floor(absolute);
36
- const minutesNotTruncated = (absolute - degrees) * 60;
37
- if (format == 'DM') {
38
- let dmMins = round(minutesNotTruncated, 3).toFixed(3).padStart(6, '0');
39
- return `${degrees}° ${dmMins}'`;
40
- }
41
- //else
42
- let minutes = Math.floor(minutesNotTruncated);
43
- let seconds = ((minutesNotTruncated - minutes) * 60).toFixed(1).padStart(4, '0');
44
- minutes = minutes.toString().padStart(2, '0');
45
- return `${degrees}° ${minutes}' ${seconds}"`;
46
- }
47
59
  function round(num, places) {
48
60
  const d = Math.pow(10, places);
49
61
  return Math.round((num + Number.EPSILON) * d) / d;
@@ -18,6 +18,7 @@ function converter(coordsString, decimalPlaces) {
18
18
  let ddLng = null;
19
19
  let latdir = "";
20
20
  let lngdir = "";
21
+ let originalFormat = null;
21
22
  let match = [];
22
23
  let matchSuccess = false;
23
24
  if (dm_numbers.test(coordsString)) {
@@ -32,6 +33,7 @@ function converter(coordsString, decimalPlaces) {
32
33
  if (Number(match[3]) < 0) {
33
34
  ddLng *= -1;
34
35
  }
36
+ originalFormat = "DM";
35
37
  }
36
38
  else {
37
39
  throw new Error("invalid coordinate format");
@@ -50,6 +52,7 @@ function converter(coordsString, decimalPlaces) {
50
52
  if (ddLng.includes(',')) {
51
53
  ddLng = ddLng.replace(',', '.');
52
54
  }
55
+ originalFormat = "DD";
53
56
  //validation, we don't want things like 23.00000
54
57
  //some more validation: no zero coords or degrees only
55
58
  if (Number(Math.round(ddLat)) == Number(ddLat)) {
@@ -79,9 +82,11 @@ function converter(coordsString, decimalPlaces) {
79
82
  ddLat = Math.abs(parseInt(match[2]));
80
83
  if (match[4]) {
81
84
  ddLat += match[4] / 60;
85
+ originalFormat = "DM";
82
86
  }
83
87
  if (match[6]) {
84
88
  ddLat += match[6].replace(',', '.') / 3600;
89
+ originalFormat = "DMS";
85
90
  }
86
91
  if (parseInt(match[2]) < 0) {
87
92
  ddLat = -1 * ddLat;
@@ -117,9 +122,11 @@ function converter(coordsString, decimalPlaces) {
117
122
  ddLat = Math.abs(parseInt(match[2]));
118
123
  if (match[4]) {
119
124
  ddLat += match[4] / 60;
125
+ originalFormat = "DM";
120
126
  }
121
127
  if (match[6]) {
122
128
  ddLat += match[6] / 3600;
129
+ originalFormat = "DMS";
123
130
  }
124
131
  if (parseInt(match[2]) < 0) {
125
132
  ddLat = -1 * ddLat;
@@ -134,6 +141,7 @@ function converter(coordsString, decimalPlaces) {
134
141
  if (parseInt(match[10]) < 0) {
135
142
  ddLng = -1 * ddLng;
136
143
  }
144
+ //the compass directions
137
145
  if (match[1]) {
138
146
  latdir = match[1];
139
147
  lngdir = match[9];
@@ -154,9 +162,11 @@ function converter(coordsString, decimalPlaces) {
154
162
  ddLat = Math.abs(parseInt(match[2]));
155
163
  if (match[4]) {
156
164
  ddLat += match[4].replace(',', '.') / 60;
165
+ originalFormat = "DM";
157
166
  }
158
167
  if (match[6]) {
159
168
  ddLat += match[6].replace(',', '.') / 3600;
169
+ originalFormat = "DMS";
160
170
  }
161
171
  if (parseInt(match[2]) < 0) {
162
172
  ddLat = -1 * ddLat;
@@ -171,6 +181,7 @@ function converter(coordsString, decimalPlaces) {
171
181
  if (parseInt(match[10]) < 0) {
172
182
  ddLng = -1 * ddLng;
173
183
  }
184
+ //the compass directions
174
185
  if (match[1]) {
175
186
  latdir = match[1];
176
187
  lngdir = match[9];
@@ -195,13 +206,20 @@ function converter(coordsString, decimalPlaces) {
195
206
  throw new Error("invalid latitude value");
196
207
  }
197
208
  //if we have one direction we must have the other
198
- if ((latdir || lngdir) && (!latdir || !lngdir)) {
199
- throw new Error("invalid coordinates format");
209
+ if ((latdir && !lngdir) || (!latdir && lngdir)) {
210
+ throw new Error("invalid coordinates value");
200
211
  }
201
212
  //the directions can't be the same
202
213
  if (latdir && latdir == lngdir) {
203
214
  throw new Error("invalid coordinates format");
204
215
  }
216
+ // a bit of tidying up...
217
+ if (ddLat.toString().includes(',')) {
218
+ ddLat = ddLat.replace(',', '.');
219
+ }
220
+ if (ddLng.toString().includes(',')) {
221
+ ddLng = ddLng.replace(',', '.');
222
+ }
205
223
  //make sure the signs and cardinal directions match
206
224
  let patt = /S|SOUTH/i;
207
225
  if (patt.test(latdir)) {
@@ -274,20 +292,12 @@ function converter(coordsString, decimalPlaces) {
274
292
  }
275
293
  }
276
294
  //no integer coords allowed
277
- //validation -- no integer coords
278
295
  if (/^\d+$/.test(verbatimLat) || /^\d+$/.test(verbatimLng)) {
279
296
  throw new Error('degree only coordinate/s provided');
280
297
  }
281
- //some tidying up...
282
- if (isNaN(ddLat) && ddLat.includes(',')) {
283
- ddLat = ddLat.replace(',', '.');
284
- }
285
298
  //all done!!
286
299
  //just truncate the decimals appropriately
287
300
  ddLat = Number(Number(ddLat).toFixed(decimalPlaces));
288
- if (isNaN(ddLng) && ddLng.includes(',')) {
289
- ddLng = ddLng.replace(',', '.');
290
- }
291
301
  ddLng = Number(Number(ddLng).toFixed(decimalPlaces));
292
302
  return Object.freeze({
293
303
  verbatimCoordinates,
@@ -296,6 +306,7 @@ function converter(coordsString, decimalPlaces) {
296
306
  decimalLatitude: ddLat,
297
307
  decimalLongitude: ddLng,
298
308
  decimalCoordinates: `${ddLat},${ddLng}`,
309
+ originalFormat,
299
310
  closeEnough: coordsCloseEnough,
300
311
  toCoordinateFormat
301
312
  });
@@ -312,11 +323,11 @@ function checkMatch(match) {
312
323
  const filteredMatch = [...match];
313
324
  //we need to shift the array because it contains the whole coordinates string in the first item
314
325
  filteredMatch.shift();
315
- //check the array length is an even number else exit
326
+ //check the array length is an even number
316
327
  if (filteredMatch.length % 2 > 0) {
317
328
  return false;
318
329
  }
319
- //regex for testing corresponding values match
330
+ // regex for testing corresponding values match
320
331
  const numerictest = /^[-+]?\d+([\.,]\d+)?$/; //for testing numeric values
321
332
  const stringtest = /[eastsouthnorthwest]+/i; //for testing string values (north, south, etc)
322
333
  const halflen = filteredMatch.length / 2;
@@ -367,6 +378,7 @@ function coordsCloseEnough(coordsToTest) {
367
378
  throw new Error("coords being tested must be separated by a comma");
368
379
  }
369
380
  }
381
+ // An enum for coordinates formats
370
382
  const to = Object.freeze({
371
383
  DMS: 'DMS',
372
384
  DM: 'DM',
@@ -0,0 +1,5 @@
1
+ // just for counting the number of test objects in the json file
2
+ // remember if you run makeTestFormatsJSON from the debugger it puts the new json file in the root directory so you have to move it here
3
+ const data = require('./testFormats.json');
4
+ let i = 0;
5
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,5 @@
1
+ // when adding new formats, make sure to add them to testformats.js, and not to testFormats.json
2
+ // use makeTestFormatsJSON.js to make testFormats.json
1
3
  import convert from '../converter.js';
2
4
  import testFormats from './testformats.js';
3
5
  import failingFormats from './failFormats.js';
@@ -3,13 +3,13 @@ let test = {
3
3
  decimalCoordinates: '-24.3456, 28.92435',
4
4
  toCoordinateFormat
5
5
  };
6
- console.log(test.toCoordinateFormat('DMS'));
6
+ console.log(test.decimalCoordinates, '==', test.toCoordinateFormat('DMS'));
7
7
  test.decimalCoordinates = '-25.76887,28.26939';
8
- console.log(test.toCoordinateFormat('DMS'));
9
- console.log(test.toCoordinateFormat('DM'));
10
- console.log(test.toCoordinateFormat('DD'));
8
+ console.log(test.decimalCoordinates, '==', test.toCoordinateFormat('DMS'));
9
+ console.log(test.decimalCoordinates, '==', test.toCoordinateFormat('DM'));
10
+ console.log(test.decimalCoordinates, '==', test.toCoordinateFormat('DD'));
11
11
  test.decimalCoordinates = '-25.815928, 28.070318';
12
- console.log(test.toCoordinateFormat('DM'));
12
+ console.log(test.decimalCoordinates, '==', test.toCoordinateFormat('DM'));
13
13
  test.decimalCoordinates = '-25.000, 28.000';
14
- console.log(test.toCoordinateFormat('DMS'));
15
- console.log(test.toCoordinateFormat('DM'));
14
+ console.log(test.decimalCoordinates, '==', test.toCoordinateFormat('DMS'));
15
+ console.log(test.decimalCoordinates, '==', test.toCoordinateFormat('DM'));
@@ -0,0 +1,394 @@
1
+ [
2
+ {
3
+ "verbatimCoordinates": "40.123, -74.123",
4
+ "verbatimLatitude": "40.123",
5
+ "verbatimLongitude": "-74.123",
6
+ "decimalLatitude": 40.123,
7
+ "decimalLongitude": -74.123
8
+ },
9
+ {
10
+ "verbatimCoordinates": "40.123° N 74.123° W",
11
+ "verbatimLatitude": "40.123° N",
12
+ "verbatimLongitude": "74.123° W",
13
+ "decimalLatitude": 40.123,
14
+ "decimalLongitude": -74.123
15
+ },
16
+ {
17
+ "verbatimCoordinates": "40.123° N 74.123° W",
18
+ "verbatimLatitude": "40.123° N",
19
+ "verbatimLongitude": "74.123° W",
20
+ "decimalLatitude": 40.123,
21
+ "decimalLongitude": -74.123
22
+ },
23
+ {
24
+ "verbatimCoordinates": "40° 7´ 22.8\" N 74° 7´ 22.8\" W",
25
+ "verbatimLatitude": "40° 7´ 22.8\" N",
26
+ "verbatimLongitude": "74° 7´ 22.8\" W",
27
+ "decimalLatitude": 40.123,
28
+ "decimalLongitude": -74.123
29
+ },
30
+ {
31
+ "verbatimCoordinates": "40° 7.38’ , -74° 7.38’",
32
+ "verbatimLatitude": "40° 7.38’",
33
+ "verbatimLongitude": "-74° 7.38’",
34
+ "decimalLatitude": 40.123,
35
+ "decimalLongitude": -74.123
36
+ },
37
+ {
38
+ "verbatimCoordinates": "N40°7’22.8’’, W74°7’22.8’’",
39
+ "verbatimLatitude": "N40°7’22.8’’",
40
+ "verbatimLongitude": "W74°7’22.8’’",
41
+ "decimalLatitude": 40.123,
42
+ "decimalLongitude": -74.123
43
+ },
44
+ {
45
+ "verbatimCoordinates": "40°7’22.8\"N, 74°7’22.8\"W",
46
+ "verbatimLatitude": "40°7’22.8\"N",
47
+ "verbatimLongitude": "74°7’22.8\"W",
48
+ "decimalLatitude": 40.123,
49
+ "decimalLongitude": -74.123
50
+ },
51
+ {
52
+ "verbatimCoordinates": "40°7'22.8\"N, 74°7'22.8\"W",
53
+ "verbatimLatitude": "40°7'22.8\"N",
54
+ "verbatimLongitude": "74°7'22.8\"W",
55
+ "decimalLatitude": 40.123,
56
+ "decimalLongitude": -74.123
57
+ },
58
+ {
59
+ "verbatimCoordinates": "40 7 22.8, -74 7 22.8",
60
+ "verbatimLatitude": "40 7 22.8",
61
+ "verbatimLongitude": "-74 7 22.8",
62
+ "decimalLatitude": 40.123,
63
+ "decimalLongitude": -74.123
64
+ },
65
+ {
66
+ "verbatimCoordinates": "40.123 -74.123",
67
+ "verbatimLatitude": "40.123",
68
+ "verbatimLongitude": "-74.123",
69
+ "decimalLatitude": 40.123,
70
+ "decimalLongitude": -74.123
71
+ },
72
+ {
73
+ "verbatimCoordinates": "40.123°,-74.123°",
74
+ "verbatimLatitude": "40.123°",
75
+ "verbatimLongitude": "-74.123°",
76
+ "decimalLatitude": 40.123,
77
+ "decimalLongitude": -74.123
78
+ },
79
+ {
80
+ "verbatimCoordinates": "40.123N74.123W",
81
+ "verbatimLatitude": "40.123N",
82
+ "verbatimLongitude": "74.123W",
83
+ "decimalLatitude": 40.123,
84
+ "decimalLongitude": -74.123
85
+ },
86
+ {
87
+ "verbatimCoordinates": "4007.38N7407.38W",
88
+ "verbatimLatitude": "4007.38N",
89
+ "verbatimLongitude": "7407.38W",
90
+ "decimalLatitude": 40.123,
91
+ "decimalLongitude": -74.123
92
+ },
93
+ {
94
+ "verbatimCoordinates": "40°7’22.8\"N, 74°7’22.8\"W",
95
+ "verbatimLatitude": "40°7’22.8\"N",
96
+ "verbatimLongitude": "74°7’22.8\"W",
97
+ "decimalLatitude": 40.123,
98
+ "decimalLongitude": -74.123
99
+ },
100
+ {
101
+ "verbatimCoordinates": "400722.8N740722.8W",
102
+ "verbatimLatitude": "400722.8N",
103
+ "verbatimLongitude": "740722.8W",
104
+ "decimalLatitude": 40.123,
105
+ "decimalLongitude": -74.123
106
+ },
107
+ {
108
+ "verbatimCoordinates": "N 40 7.38 W 74 7.38",
109
+ "verbatimLatitude": "N 40 7.38",
110
+ "verbatimLongitude": "W 74 7.38",
111
+ "decimalLatitude": 40.123,
112
+ "decimalLongitude": -74.123
113
+ },
114
+ {
115
+ "verbatimCoordinates": "40:7:22.8N 74:7:22.8W",
116
+ "verbatimLatitude": "40:7:22.8N",
117
+ "verbatimLongitude": "74:7:22.8W",
118
+ "decimalLatitude": 40.123,
119
+ "decimalLongitude": -74.123
120
+ },
121
+ {
122
+ "verbatimCoordinates": "40:7:23N,74:7:23W",
123
+ "verbatimLatitude": "40:7:23N",
124
+ "verbatimLongitude": "74:7:23W",
125
+ "decimalLatitude": 40.1230555555,
126
+ "decimalLongitude": -74.1230555555
127
+ },
128
+ {
129
+ "verbatimCoordinates": "40°7’23\"N 74°7’23\"W",
130
+ "verbatimLatitude": "40°7’23\"N",
131
+ "verbatimLongitude": "74°7’23\"W",
132
+ "decimalLatitude": 40.1230555555,
133
+ "decimalLongitude": -74.12305555555555
134
+ },
135
+ {
136
+ "verbatimCoordinates": "40°7’23\"S 74°7’23\"E",
137
+ "verbatimLatitude": "40°7’23\"S",
138
+ "verbatimLongitude": "74°7’23\"E",
139
+ "decimalLatitude": -40.1230555555,
140
+ "decimalLongitude": 74.12305555555555
141
+ },
142
+ {
143
+ "verbatimCoordinates": "40°7’23\" -74°7’23\"",
144
+ "verbatimLatitude": "40°7’23\"",
145
+ "verbatimLongitude": "-74°7’23\"",
146
+ "decimalLatitude": 40.1230555555,
147
+ "decimalLongitude": -74.123055555
148
+ },
149
+ {
150
+ "verbatimCoordinates": "40d 7’ 23\" N 74d 7’ 23\" W",
151
+ "verbatimLatitude": "40d 7’ 23\" N",
152
+ "verbatimLongitude": "74d 7’ 23\" W",
153
+ "decimalLatitude": 40.1230555555,
154
+ "decimalLongitude": -74.123055555
155
+ },
156
+ {
157
+ "verbatimCoordinates": "40.123N 74.123W",
158
+ "verbatimLatitude": "40.123N",
159
+ "verbatimLongitude": "74.123W",
160
+ "decimalLatitude": 40.123,
161
+ "decimalLongitude": -74.123
162
+ },
163
+ {
164
+ "verbatimCoordinates": "40° 7.38, -74° 7.38",
165
+ "verbatimLatitude": "40° 7.38",
166
+ "verbatimLongitude": "-74° 7.38",
167
+ "decimalLatitude": 40.123,
168
+ "decimalLongitude": -74.123
169
+ },
170
+ {
171
+ "verbatimCoordinates": "40° 7.38, -74° 7.38",
172
+ "verbatimLatitude": "40° 7.38",
173
+ "verbatimLongitude": "-74° 7.38",
174
+ "decimalLatitude": 40.123,
175
+ "decimalLongitude": -74.123
176
+ },
177
+ {
178
+ "verbatimCoordinates": "40 7 22.8; -74 7 22.8",
179
+ "verbatimLatitude": "40 7 22.8",
180
+ "verbatimLongitude": "-74 7 22.8",
181
+ "decimalLatitude": 40.123,
182
+ "decimalLongitude": -74.123
183
+ },
184
+ {
185
+ "verbatimCoordinates": "50°4'17.698\"south, 14°24'2.826\"east",
186
+ "verbatimLatitude": "50°4'17.698\"south",
187
+ "verbatimLongitude": "14°24'2.826\"east",
188
+ "decimalLatitude": -50.07158277777778,
189
+ "decimalLongitude": 14.400785
190
+ },
191
+ {
192
+ "verbatimCoordinates": "50d4m17.698S 14d24m2.826E",
193
+ "verbatimLatitude": "50d4m17.698S",
194
+ "verbatimLongitude": "14d24m2.826E",
195
+ "decimalLatitude": -50.07158277777778,
196
+ "decimalLongitude": 14.400785
197
+ },
198
+ {
199
+ "verbatimCoordinates": "40:26:46N,79:56:55W",
200
+ "verbatimLatitude": "40:26:46N",
201
+ "verbatimLongitude": "79:56:55W",
202
+ "decimalLatitude": 40.44611111111111,
203
+ "decimalLongitude": -79.9486111111111
204
+ },
205
+ {
206
+ "verbatimCoordinates": "40:26:46.302N 79:56:55.903W",
207
+ "verbatimLatitude": "40:26:46.302N",
208
+ "verbatimLongitude": "79:56:55.903W",
209
+ "decimalLatitude": 40.446195,
210
+ "decimalLongitude": -79.94886194444445
211
+ },
212
+ {
213
+ "verbatimCoordinates": "40°26′47″N 79°58′36″W",
214
+ "verbatimLatitude": "40°26′47″N",
215
+ "verbatimLongitude": "79°58′36″W",
216
+ "decimalLatitude": 40.44638888888889,
217
+ "decimalLongitude": -79.97666666666667
218
+ },
219
+ {
220
+ "verbatimCoordinates": "40d 26′ 47″ N 79d 58′ 36″ W",
221
+ "verbatimLatitude": "40d 26′ 47″ N",
222
+ "verbatimLongitude": "79d 58′ 36″ W",
223
+ "decimalLatitude": 40.44638888888889,
224
+ "decimalLongitude": -79.97666666666667
225
+ },
226
+ {
227
+ "verbatimCoordinates": "40.446195N 79.948862W",
228
+ "verbatimLatitude": "40.446195N",
229
+ "verbatimLongitude": "79.948862W",
230
+ "decimalLatitude": 40.446195,
231
+ "decimalLongitude": -79.948862
232
+ },
233
+ {
234
+ "verbatimCoordinates": "40,446195° 79,948862°",
235
+ "verbatimLatitude": "40,446195°",
236
+ "verbatimLongitude": "79,948862°",
237
+ "decimalLatitude": 40.446195,
238
+ "decimalLongitude": 79.948862
239
+ },
240
+ {
241
+ "verbatimCoordinates": "40° 26.7717, -79° 56.93172",
242
+ "verbatimLatitude": "40° 26.7717",
243
+ "verbatimLongitude": "-79° 56.93172",
244
+ "decimalLatitude": 40.446195,
245
+ "decimalLongitude": -79.948862
246
+ },
247
+ {
248
+ "verbatimCoordinates": "40.446195, -79.948862",
249
+ "verbatimLatitude": "40.446195",
250
+ "verbatimLongitude": "-79.948862",
251
+ "decimalLatitude": 40.446195,
252
+ "decimalLongitude": -79.948862
253
+ },
254
+ {
255
+ "verbatimCoordinates": "40.123256; -74.123256",
256
+ "verbatimLatitude": "40.123256",
257
+ "verbatimLongitude": "-74.123256",
258
+ "decimalLatitude": 40.123256,
259
+ "decimalLongitude": -74.123256
260
+ },
261
+ {
262
+ "verbatimCoordinates": "18°24S 22°45E",
263
+ "verbatimLatitude": "18°24S",
264
+ "verbatimLongitude": "22°45E",
265
+ "decimalLatitude": -18.4,
266
+ "decimalLongitude": 22.75
267
+ },
268
+ {
269
+ "verbatimCoordinates": "10.432342S 10.6345345E",
270
+ "verbatimLatitude": "10.432342S",
271
+ "verbatimLongitude": "10.6345345E",
272
+ "decimalLatitude": -10.432342,
273
+ "decimalLongitude": 10.6345345
274
+ },
275
+ {
276
+ "verbatimCoordinates": "10.00S 10.00E",
277
+ "verbatimLatitude": "10.00S",
278
+ "verbatimLongitude": "10.00E",
279
+ "decimalLatitude": -10,
280
+ "decimalLongitude": 10
281
+ },
282
+ {
283
+ "verbatimCoordinates": "00.00S 01.00E",
284
+ "verbatimLatitude": "00.00S",
285
+ "verbatimLongitude": "01.00E",
286
+ "decimalLatitude": 0,
287
+ "decimalLongitude": 1
288
+ },
289
+ {
290
+ "verbatimCoordinates": "18.24S 22.45E",
291
+ "verbatimLatitude": "18.24S",
292
+ "verbatimLongitude": "22.45E",
293
+ "decimalLatitude": -18.4,
294
+ "decimalLongitude": 22.75
295
+ },
296
+ {
297
+ "verbatimCoordinates": "27deg 15min 45.2sec S 18deg 32min 53.7sec E",
298
+ "verbatimLatitude": "27deg 15min 45.2sec S",
299
+ "verbatimLongitude": "18deg 32min 53.7sec E",
300
+ "decimalLatitude": -27.262555555555554,
301
+ "decimalLongitude": 18.54825
302
+ },
303
+ {
304
+ "verbatimCoordinates": "-23.3245° S / 28.2344° E",
305
+ "verbatimLatitude": "-23.3245° S",
306
+ "verbatimLongitude": "28.2344° E",
307
+ "decimalLatitude": -23.3245,
308
+ "decimalLongitude": 28.2344
309
+ },
310
+ {
311
+ "verbatimCoordinates": "40° 26.7717 -79° 56.93172",
312
+ "verbatimLatitude": "40° 26.7717",
313
+ "verbatimLongitude": "-79° 56.93172",
314
+ "decimalLatitude": 40.446195,
315
+ "decimalLongitude": -79.948862
316
+ },
317
+ {
318
+ "verbatimCoordinates": "27.15.45S 18.32.53E",
319
+ "verbatimLatitude": "27.15.45S",
320
+ "verbatimLongitude": "18.32.53E",
321
+ "decimalLatitude": -27.2625,
322
+ "decimalLongitude": 18.548055
323
+ },
324
+ {
325
+ "verbatimCoordinates": "-27.15.45 18.32.53",
326
+ "verbatimLatitude": "-27.15.45",
327
+ "verbatimLongitude": "18.32.53",
328
+ "decimalLatitude": -27.2625,
329
+ "decimalLongitude": 18.548055
330
+ },
331
+ {
332
+ "verbatimCoordinates": "27.15.45.2S 18.32.53.4E",
333
+ "verbatimLatitude": "27.15.45.2S",
334
+ "verbatimLongitude": "18.32.53.4E",
335
+ "decimalLatitude": -27.262556,
336
+ "decimalLongitude": 18.548167
337
+ },
338
+ {
339
+ "verbatimCoordinates": "27.15.45,2S 18.32.53,4E",
340
+ "verbatimLatitude": "27.15.45,2S",
341
+ "verbatimLongitude": "18.32.53,4E",
342
+ "decimalLatitude": -27.262556,
343
+ "decimalLongitude": 18.548167
344
+ },
345
+ {
346
+ "verbatimCoordinates": "S23.43563 ° E22.45634 °",
347
+ "verbatimLatitude": "S23.43563 °",
348
+ "verbatimLongitude": "E22.45634 °",
349
+ "decimalLatitude": -23.43563,
350
+ "decimalLongitude": 22.45634
351
+ },
352
+ {
353
+ "verbatimCoordinates": "27,71372° S 23,07771° E",
354
+ "verbatimLatitude": "27,71372° S",
355
+ "verbatimLongitude": "23,07771° E",
356
+ "decimalLatitude": -27.71372,
357
+ "decimalLongitude": 23.07771
358
+ },
359
+ {
360
+ "verbatimCoordinates": "27.45.34 S 23.23.23 E",
361
+ "verbatimLatitude": "27.45.34 S",
362
+ "verbatimLongitude": "23.23.23 E",
363
+ "decimalLatitude": -27.759444,
364
+ "decimalLongitude": 23.38972222
365
+ },
366
+ {
367
+ "verbatimCoordinates": "S 27.45.34 E 23.23.23",
368
+ "verbatimLatitude": "S 27.45.34",
369
+ "verbatimLongitude": "E 23.23.23",
370
+ "decimalLatitude": -27.759444,
371
+ "decimalLongitude": 23.38972222
372
+ },
373
+ {
374
+ "verbatimCoordinates": "53 16.3863,4 52.8171",
375
+ "verbatimLatitude": "53 16.3863",
376
+ "verbatimLongitude": "4 52.8171",
377
+ "decimalLatitude": 53.273105,
378
+ "decimalLongitude": 4.88029
379
+ },
380
+ {
381
+ "verbatimCoordinates": "50 8.2914,-5 2.4447",
382
+ "verbatimLatitude": "50 8.2914",
383
+ "verbatimLongitude": "-5 2.4447",
384
+ "decimalLatitude": 50.13819,
385
+ "decimalLongitude": -5.040745
386
+ },
387
+ {
388
+ "verbatimCoordinates": "N 48° 30,6410', E 18° 57,4583'",
389
+ "verbatimLatitude": "N 48° 30,6410'",
390
+ "verbatimLongitude": "E 18° 57,4583'",
391
+ "decimalLatitude": 48.51068,
392
+ "decimalLongitude": 18.95764
393
+ }
394
+ ]
@@ -234,8 +234,8 @@ const coordsRegexFormats = [
234
234
  decimalLongitude: 22.75
235
235
  }
236
236
  ];
237
+ // additional formats we've encountered
237
238
  const otherFormats = [
238
- // additional formats we've encountered
239
239
  {
240
240
  verbatimCoordinates: '10.432342S 10.6345345E',
241
241
  verbatimLatitude: '10.432342S',