[openstreetmap/openstreetmap-website] Fixed displacing points specified from context menu (PR #4904)
Nenad Vujicic
notifications at github.com
Tue Aug 20 12:33:28 UTC 2024
@nenad-vujicic commented on this pull request.
> - endpoint.setLatLng(L.latLng(json[0]));
+ if (endpoint.value.match(new RegExp("^" + coordinatesRegularExpression + "$"))) {
+ var latlng_array = endpoint.value.split(/[/,]/);
+ $.getJSON(OSM.NOMINATIM_URL + "reverse?lat=" + latlng_array[0] + "&lon=" + latlng_array[1] + "&format=json&viewbox=" + viewbox, function (json) {
+ endpoint.awaitingGeocode = false;
+ endpoint.hasGeocode = true;
+
+ endpoint.setLatLng(L.latLng(latlng_array), false, true);
+
+ if (!json || !json.display_name) {
+ input.addClass("is-invalid");
+ alert(I18n.t("javascripts.directions.errors.no_place", { place: endpoint.value }));
+ return;
+ }
+
+ if (endpoint.latlng.distanceTo(L.latLng(json.lat, json.lon)) > 200.0) {
Yes, exactly! If it is found something near (e.g. 200m) the clicked coordinates, accept it, otherwise, display coordinates.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4904#discussion_r1723234687
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/4904/review/2247866057 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240820/a86432e5/attachment.htm>
More information about the rails-dev
mailing list