<p dir="auto">This changes the number of fractional digits to log10(pixels / degrees) with pixels = 2**(8 + zoom) and degrees = 180.</p>
<hr>
<p dir="auto">If you apply the entire <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>, zoom in to the max zoom level, place an endpoint marker and try to drag it around, you'll notice it moves by jumping several pixels. This is because I limit its coordinates to zoom precision and zoom precision is not high enough. Its current version was introduced in <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/openstreetmap/openstreetmap-website/commit/b28511faca45d8d8abc0d3c2fde5a501bbe94062/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/commit/b28511faca45d8d8abc0d3c2fde5a501bbe94062"><tt>b28511f</tt></a>. You can notice something strange about it: the zoom value went from being an argument of <code class="notranslate">Math.pow</code> to an argument of <code class="notranslate">Math.log</code>. <code class="notranslate">zoom</code> is already on a log scale, why do you need to take its log again?</p>
<markdown-accessiblity-table><table role="table">
<thead>
<tr>
<th>zoom</th>
<th>old zoomPrecision</th>
<th>new zoomPrecision</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>0</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>0</td>
<td>1</td>
</tr>
<tr>
<td>2</td>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td>3</td>
<td>2</td>
<td>2</td>
</tr>
<tr>
<td>4</td>
<td>2</td>
<td>2</td>
</tr>
<tr>
<td>5</td>
<td>3</td>
<td>2</td>
</tr>
<tr>
<td>6</td>
<td>3</td>
<td>2</td>
</tr>
<tr>
<td>7</td>
<td>3</td>
<td>3</td>
</tr>
<tr>
<td>8</td>
<td>3</td>
<td>3</td>
</tr>
<tr>
<td>9</td>
<td>4</td>
<td>3</td>
</tr>
<tr>
<td>10</td>
<td>4</td>
<td>4</td>
</tr>
<tr>
<td>11</td>
<td>4</td>
<td>4</td>
</tr>
<tr>
<td>12</td>
<td>4</td>
<td>4</td>
</tr>
<tr>
<td>13</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>14</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>15</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>16</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>17</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>18</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>19</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>20</td>
<td>5</td>
<td>7</td>
</tr>
<tr>
<td>21</td>
<td>5</td>
<td>7</td>
</tr>
</tbody>
</table></markdown-accessiblity-table>
<p dir="auto">Some layers go up to zoom 21, precision limits become very noticeable there. Even on level 0 you need at least one digit after <code class="notranslate">.</code> to translate -90..+90 to 256 tile pixels.</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/5084'>https://github.com/openstreetmap/openstreetmap-website/pull/5084</a></p>
<h4>Commit Summary</h4>
<ul>
<li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5084/commits/cfdebb9de76ca31e8915b52a25362e69f016f573" class="commit-link">cfdebb9</a> Change zoom precision function</li>
</ul>
<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5084/files">1 file</a>)</p>
<ul>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5084/files#diff-a9b88a8a3644f944b9bd54361da588c69fa6a210cf7327194c17895a8ad2b0d6">app/assets/javascripts/osm.js.erb</a>
(2)
</li>
</ul>
<h4>Patch Links:</h4>
<ul>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/5084.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/5084.patch</a></li>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/5084.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/5084.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/5084">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLOESZETFLPS7Q3J7XLZRWZDNAVCNFSM6AAAAABMTT743GVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ3DSNZWHA2TGNY">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLOCUTY4IDR777WK3L3ZRWZDNA5CNFSM6AAAAABMTT743GWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHJGNNNLE.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/5084</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/5084",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/5084",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>