Do not display two coordinates on 'where am I' click

Closes #1968
This commit is contained in:
Ilya Zverev 2018-09-03 12:05:25 +03:00 committed by Tom Hughes
parent d792a3bab5
commit 67925e6d98
3 changed files with 5 additions and 3 deletions

View file

@ -49,7 +49,7 @@ OSM.initializeContextMenu = function (map) {
lat = latlng.lat.toFixed(precision), lat = latlng.lat.toFixed(precision),
lng = latlng.lng.toFixed(precision); lng = latlng.lng.toFixed(precision);
OSM.router.route("/search?query=" + encodeURIComponent(lat + "," + lng)); OSM.router.route("/search?whereami=1&query=" + encodeURIComponent(lat + "," + lng));
} }
}); });

View file

@ -34,7 +34,7 @@ OSM.Search = function(map) {
e.preventDefault(); e.preventDefault();
var center = map.getCenter().wrap(), var center = map.getCenter().wrap(),
precision = OSM.zoomPrecision(map.getZoom()); precision = OSM.zoomPrecision(map.getZoom());
OSM.router.route("/search?query=" + encodeURIComponent( OSM.router.route("/search?whereami=1&query=" + encodeURIComponent(
center.lat.toFixed(precision) + "," + center.lng.toFixed(precision) center.lat.toFixed(precision) + "," + center.lng.toFixed(precision)
)); ));
}); });

View file

@ -305,7 +305,9 @@ class GeocoderController < ApplicationController
params.merge!(dms_to_decdeg(latlon)).delete(:query) params.merge!(dms_to_decdeg(latlon)).delete(:query)
elsif latlon = query.match(/^\s*([+-]?\d+(\.\d*)?)\s*[\s,]\s*([+-]?\d+(\.\d*)?)\s*$/) elsif latlon = query.match(/^\s*([+-]?\d+(\.\d*)?)\s*[\s,]\s*([+-]?\d+(\.\d*)?)\s*$/)
params.merge!(:lat => latlon[1].to_f, :lon => latlon[3].to_f, :latlon_digits => true).delete(:query) params.merge!(:lat => latlon[1].to_f, :lon => latlon[3].to_f).delete(:query)
params[:latlon_digits] = true unless params[:whereami]
end end
end end