diff --git a/.jshintrc b/.jshintrc index e0410b22c..5582195ae 100644 --- a/.jshintrc +++ b/.jshintrc @@ -16,6 +16,7 @@ "rbush": false, "JXON": false, "osmAuth": false, + "sexagesimal": false, "toGeoJSON": false, "marked": false }, diff --git a/Makefile b/Makefile index fc3df7b44..73ef4ab58 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,7 @@ dist/iD.js: \ js/lib/lodash.js \ js/lib/osmauth.js \ js/lib/rbush.js \ + js/lib/sexagesimal.js \ js/lib/togeojson.js \ js/lib/marked.js \ js/id/start.js \ diff --git a/index.html b/index.html index 96c3b1057..69768a885 100644 --- a/index.html +++ b/index.html @@ -31,6 +31,7 @@ + diff --git a/js/id/ui/feature_list.js b/js/id/ui/feature_list.js index 77d27d4e2..0786ca9e7 100644 --- a/js/id/ui/feature_list.js +++ b/js/id/ui/feature_list.js @@ -67,15 +67,16 @@ iD.ui.FeatureList = function(context) { }); } - var locationMatch = q.match(/^(-?\d+\.?\d*)\s+(-?\d+\.?\d*)$/); + var locationMatch = sexagesimal.pair(q.toUpperCase()) || q.match(/^(-?\d+\.?\d*)\s+(-?\d+\.?\d*)$/); if (locationMatch) { + var loc = [parseFloat(locationMatch[0]), parseFloat(locationMatch[1])]; result.push({ id: -1, geometry: 'point', type: t('inspector.location'), - name: locationMatch[0], - location: [parseFloat(locationMatch[1]), parseFloat(locationMatch[2])] + name: loc[0].toFixed(6) + ', ' + loc[1].toFixed(6), + location: loc }); } diff --git a/js/lib/index.html b/js/lib/index.html new file mode 100644 index 000000000..9b2edbac2 --- /dev/null +++ b/js/lib/index.html @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/js/lib/sexagesimal.js b/js/lib/sexagesimal.js new file mode 100644 index 000000000..fdf55eb35 --- /dev/null +++ b/js/lib/sexagesimal.js @@ -0,0 +1,73 @@ +(function(e){if("function"==typeof bootstrap)bootstrap("sexagesimal",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeSexagesimal=e}else"undefined"!=typeof window?window.sexagesimal=e():global.sexagesimal=e()})(function(){var define,ses,bootstrap,module,exports; +return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o