diff --git a/modules/util/units.js b/modules/util/units.js index 7b1f21599..7178fd5b6 100644 --- a/modules/util/units.js +++ b/modules/util/units.js @@ -214,6 +214,14 @@ export function dmsMatcher(q, _localeCode = undefined) { return [isNegLat, isNegLng]; } }, + // D/D ex: 46.112785/72.921033 + { + condition: /^\s*(-?\d+\.?\d*)\s*\/\s*(-?\d+\.?\d*)\s*$/, + parser: function(q) { + const match = this.condition.exec(q); + return [+match[1], +match[2]]; + } + }, // zoom/x/y ex: 2/1.23/34.44 { condition: /^\s*(\d+\.?\d*)\s*\/\s*(-?\d+\.?\d*)\s*\/\s*(-?\d+\.?\d*)\s*$/, diff --git a/test/spec/util/units.js b/test/spec/util/units.js index a2feaea7b..0eec3e963 100644 --- a/test/spec/util/units.js +++ b/test/spec/util/units.js @@ -28,7 +28,7 @@ describe('iD.units', function() { expect(result[2]).to.eql(2); }); it('parses x/y coordinate', () => { - var result = iD.dmsMatcher('-1.23/34.44'); + var result = iD.dmsMatcher('-1.23/34.44', 'de'); expect(result[0]).to.be.closeTo(-1.23, 0.00001); expect(result[1]).to.be.closeTo(34.44, 0.00001); });