[openstreetmap/openstreetmap-website] Always use coordinates when using directions from context menu (PR #5099)
Anton Khorev
notifications at github.com
Tue Aug 20 11:04:56 UTC 2024
Part of the problem #5064 tries to solve are the result of the context menu using addresses from endpoint inputs.
You right click somewhere, select "Directions from here" and it goes to and url like this: `/directions?from=51.420436%2C-0.174805&to=`. Then you right click somewhere else, select "Directions to here" and the url becomes something like this: `/directions?from=Park%20Road%2C%20Collier%27s%20Wood%2C%20London%20Borough%20of%20Merton%2C%20London%2C%20Greater%20London%2C%20England%2C%20SW19%202HT%2C%20United%20Kingdom&to=51.420563%2C-0.171007`. The coordinates in `from` got replaced by an address. It's impossible to get the original coordinates from an address.
The solution here is to save the coordinates to `data-lat` and `data-lon` attributes of inputs. The context menu then can generate directions urls using the values stored there.
This doesn't solve the entire problem because there's also uncontrolled reverse geocoding decided by Nominatim when using its freeform query.
You can view, comment on, or merge this pull request online at:
https://github.com/openstreetmap/openstreetmap-website/pull/5099
-- Commit Summary --
* Limit coordinate precision in drag listener
* Save lat/lon to input data attributes
* Read lat/lon attributes when generating context menu directions urls
-- File Changes --
M app/assets/javascripts/index/contextmenu.js (12)
M app/assets/javascripts/index/directions-endpoint.js (20)
M app/assets/javascripts/index/directions.js (3)
-- Patch Links --
https://github.com/openstreetmap/openstreetmap-website/pull/5099.patch
https://github.com/openstreetmap/openstreetmap-website/pull/5099.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5099
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5099 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240820/8badbc4d/attachment.htm>
More information about the rails-dev
mailing list