<p dir="auto">Part of the problem <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2459415506" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/5064" data-hovercard-type="pull_request" data-hovercard-url="/openstreetmap/openstreetmap-website/pull/5064/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/pull/5064">#5064</a> tries to solve are the result of the context menu using addresses from endpoint inputs.</p>
<p dir="auto">You right click somewhere, select "Directions from here" and it goes to and url like this: <code class="notranslate">/directions?from=51.420436%2C-0.174805&to=</code>. Then you right click somewhere else, select "Directions to here" and the url becomes something like this: <code class="notranslate">/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</code>. The coordinates in <code class="notranslate">from</code> got replaced by an address. It's impossible to get the original coordinates from an address.</p>
<p dir="auto">The solution here is to save the coordinates to <code class="notranslate">data-lat</code> and <code class="notranslate">data-lon</code> attributes of inputs. The context menu then can generate directions urls using the values stored there.</p>
<p dir="auto">This doesn't solve the entire problem because there's also uncontrolled reverse geocoding decided by Nominatim when using its freeform query.</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/openstreetmap/openstreetmap-website/pull/5099'>https://github.com/openstreetmap/openstreetmap-website/pull/5099</a></p>

<h4>Commit Summary</h4>
<ul>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5099/commits/bc2937fae61e53c42f7b5fbe2e91aa6f759c6b1a" class="commit-link">bc2937f</a>  Limit coordinate precision in drag listener</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5099/commits/2a2970d9b12b7f1c2ddb3a653514cf44c556edb1" class="commit-link">2a2970d</a>  Save lat/lon to input data attributes</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5099/commits/cfbde45090045361630fdabaffc873c62d0d8eef" class="commit-link">cfbde45</a>  Read lat/lon attributes when generating context menu directions urls</li>
</ul>

<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5099/files">3 files</a>)</p>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5099/files#diff-3e81b28faf8dfac2dcfdc2454ed4d17ee7b60abfb774f5ea00ed38799e624798">app/assets/javascripts/index/contextmenu.js</a>
    (12)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5099/files#diff-720e11d91a0c3a64a70dd6bfad46c242e9f4755b2470797031de5b55ff9a8c5d">app/assets/javascripts/index/directions-endpoint.js</a>
    (20)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5099/files#diff-fdb9558c2ba79ddf9fbcb92594a8a8fa54abb1b3e25ce264de37951b428a958b">app/assets/javascripts/index/directions.js</a>
    (3)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/5099.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/5099.patch</a></li>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/5099.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/5099.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5099">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLI7C67NSQIRUMZ62ULZSMPFRAVCNFSM6AAAAABMZU42OSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ3TKMZWGA4TCMY">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLNCUQG2P2IT2D4T36TZSMPFRA5CNFSM6AAAAABMZU42OSWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHJHCYCSE.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/5099</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/5099",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/5099",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>