<p></p>
<p dir="auto">I had similar issue today where after holiday season i wanted to catch up with changes made in local area over the past few weeks, but sadly there was recently very large undiscussed import, which was promptly followed by series revertions from DWG. So, how about adding option to OSM website's history (osm.org/history) view to hide changesets that don't fit into current bounding box? Luckily there's already this issue, so i won't create a duplicate one.</p>
<p dir="auto">From technical viewpoint, this seems to be relatively simple change, adding around 10-15 lines of code in <a href="https://github.com/openstreetmap/openstreetmap-website/blob/f1c6a87aa137c11d0aff5a4b0e563ac2c2a8f82d/app/controllers/api/changesets_controller.rb#L258-L261">backend</a> for how changesets are filtered (just additional nested if-statement and support for two new parameters on ln162), 15-20 lines for <a href="https://github.com/openstreetmap/openstreetmap-website/blob/d02b8d9f1ed9b99651cdffae69b8c70e533d5517/app/views/changesets/history.html.erb#L15">adding checkbox to frontend UI</a> and passing checkbox and slider value to API in <a href="https://github.com/openstreetmap/openstreetmap-website/blob/70d7d8d850148f714b70a3297c02a8203214dec6/app/assets/javascripts/index/history.js#L62">update() function</a>. I think I'm missing here something from what receives response from API and converts it into pretty html.</p>
<p dir="auto">Here's quick UI prototype for filtering. Slider could disappear when checkbox is unchecked. Some users might prefer numeric entry for determining how large bounding boxes should be selected, but i felt that having to type some value into the field would feel unnatural and inconsistent with rest of website's mouse-oriented UI. For same reason checkbox and slider don't have "Submit" button, if anyone wonders.</p>
<details>
<summary>HTML code for the UI prototype below</summary>
<div class="highlight highlight-text-html-basic"><pre><span class="pl-kos"><</span><span class="pl-ent">div</span> <span class="pl-c1">class</span>="<span class="pl-s">add-meaningful-name</span>"<span class="pl-kos">></span>
<span class="pl-kos"><</span><span class="pl-ent">input</span> <span class="pl-c1">type</span>="<span class="pl-s">checkbox</span>" <span class="pl-c1">id</span>="<span class="pl-s">hide-cs</span>" <span class="pl-c1">name</span>="<span class="pl-s">hide-cs</span>" <span class="pl-c1">onchange</span>="<span class="pl-s">update()</span>"<span class="pl-kos">></span>
<span class="pl-kos"><</span><span class="pl-ent">label</span> <span class="pl-c1">for</span>="<span class="pl-s">hide-cs</span>"<span class="pl-kos">></span>Hide very large changesets<span class="pl-kos"></</span><span class="pl-ent">label</span><span class="pl-kos">></span><span class="pl-kos"><</span><span class="pl-ent">br</span><span class="pl-kos">></span>
<span class="pl-kos"><</span><span class="pl-ent">span</span> <span class="pl-c1">class</span>="<span class="pl-s">add-name-for-collapsible-class</span>"<span class="pl-kos">></span>
Select size sensitivity:<span class="pl-kos"><</span><span class="pl-ent">br</span><span class="pl-kos">></span>
Smaller <span class="pl-kos"><</span><span class="pl-ent">input</span> <span class="pl-c1">type</span>="<span class="pl-s">range</span>" <span class="pl-c1">min</span>="<span class="pl-s">1</span>" <span class="pl-c1">max</span>="<span class="pl-s">5</span>" <span class="pl-c1">value</span>="<span class="pl-s">2</span>" <span class="pl-c1">class</span>="<span class="pl-s">chset-bbox-slider</span>" <span class="pl-c1">onchange</span>="<span class="pl-s">update()</span>"<span class="pl-kos">></span> Larger
<span class="pl-kos"></</span><span class="pl-ent">span</span><span class="pl-kos">></span>
<span class="pl-kos"></</span><span class="pl-ent">div</span><span class="pl-kos">></span></pre></div>
</details>
<p dir="auto"><a target="_blank" rel="noopener noreferrer" href="https://camo.githubusercontent.com/6d8d1170ed58887b63284eb2ca2178bba1dcaeeb7c6b64bb3c3846b8d86f547b/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f3630373236353036323332323730303330382f3932383631363431363335363233373331322f756e6b6e6f776e2e706e67"><img src="https://camo.githubusercontent.com/6d8d1170ed58887b63284eb2ca2178bba1dcaeeb7c6b64bb3c3846b8d86f547b/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f3630373236353036323332323730303330382f3932383631363431363335363233373331322f756e6b6e6f776e2e706e67" alt="Prototype UI" data-canonical-src="https://cdn.discordapp.com/attachments/607265062322700308/928616416356237312/unknown.png" style="max-width: 100%;"></a></p>
<p dir="auto">Another portion is so-called "business decisions" for determining the actual behaviour of the slider. I don't think that hiding a large changeset could hide many relevant changesets mostly due to probability of how changed elements are distributed around changeset area. The larger the changeset area, the less likely it is to contain modifications in currently viewed area. Obviously this should be optional feature deselected by default, but looking at large changesets, here in Estonia they are usually irrelevant changes often focusing on Russia or Norway.</p>
<p dir="auto">Questionable part is deciding where goes the borderline for selection of the changeset. Initial idea was to show only changesets which fit fully in the viewport. Another suggestion involved calculating area of bounding box and comparing it against area of viewport, but I'm afraid performing such calculations might be too demanding for the server. Also, said area can't be a constant due to map having multiple zoom levels. Perhaps ignore changesets, where current viewport area is less than X% of the changeset area? X is determined by the slider.</p>
<p dir="auto">Finally, we are talking here about spatial database queries done on server infra possibly millions times per second, meaning the more refined changeset filtering algorithm is selected, more significant performance impact it would have. Computationally least expensive could be following filter (based on <a href="https://github.com/openstreetmap/openstreetmap-website/blob/f1c6a87aa137c11d0aff5a4b0e563ac2c2a8f82d/app/controllers/api/changesets_controller.rb#L258-L261">existing method</a>):</p>
<div class="highlight highlight-source-ruby"><pre><span class="pl-en">changesets</span><span class="pl-kos">.</span><span class="pl-en">where</span><span class="pl-kos">(</span><span class="pl-s">"min_lon < ? and max_lon > ? and min_lat < ? and max_lat > ?"</span><span class="pl-kos">,</span>
<span class="pl-en">bbox</span><span class="pl-kos">.</span><span class="pl-en">min_lon</span><span class="pl-kos">.</span><span class="pl-en">to_i</span><span class="pl-kos">,</span> <span class="pl-en">bbox</span><span class="pl-kos">.</span><span class="pl-en">max_lon</span><span class="pl-kos">.</span><span class="pl-en">to_i</span><span class="pl-kos">,</span>
<span class="pl-en">bbox</span><span class="pl-kos">.</span><span class="pl-en">min_lat</span><span class="pl-kos">.</span><span class="pl-en">to_i</span><span class="pl-kos">,</span> <span class="pl-en">bbox</span><span class="pl-kos">.</span><span class="pl-en">max_lat</span><span class="pl-kos">.</span><span class="pl-en">to_i</span><span class="pl-kos">)</span></pre></div>
<p dir="auto">PS. Probably I don't know how Ruby works because i have never used it, but shouldn't API <a href="https://github.com/openstreetmap/openstreetmap-website/blob/f1c6a87aa137c11d0aff5a4b0e563ac2c2a8f82d/app/controllers/api/changesets_controller.rb#L347"><code>changesets</code> endpoint</a> also support URL parameters <code>open/closed=false</code>, currently it seems to only check if parameter is present, not it's value. Therefore code from that part is probably not reusable for the changeset filtering methods.</p>
<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/issues/3242#issuecomment-1006709194">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLMGLW54QGGJRYPJWN3UUW4YLANCNFSM47VPTUVA">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLNI6DT4A2FXIYETBO3UUW4YLA5CNFSM47VPTUVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHQASTSQ.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/issues/3242/1006709194</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/issues/3242#issuecomment-1006709194",
"url": "https://github.com/openstreetmap/openstreetmap-website/issues/3242#issuecomment-1006709194",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>