<table><tr><td style="">tandon created this revision.<br />tandon added reviewers: rahn, nienhueser.<br />tandon added subscribers: Marble, nienhueser.<br />tandon set the repository for this revision to rMARBLE Marble.</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D2376" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>Uses <a href="https://en.wikipedia.org/wiki/DBSCAN" class="remarkup-link" target="_blank" rel="noreferrer">DBSCAN</a> clustering algorithm to identify building clusters and then merges these clusters using QPolygonF::united() method.</p>

<p>However, the buildings are not getting correctly written in the output OSM file.<br />
We are getting buildings of the form</p>

<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p><way id="237536278" changeset="31318507" timestamp="2015-05-20T15:41:52Z" uid="35468" user="Blunauer" version="2" visible="true"></p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">    <tag k="building" v="yes"/>
    <nd ref="2454247856"/>
    <nd ref="3530939281"/>
    <nd ref="0"/>
    <nd ref="0"/>
    <nd ref="0"/>
    <nd ref="0"/>
    <nd ref="0"/>
    <nd ref="0"/>
    <nd ref="0"/>
    <nd ref="0"/>
    <nd ref="0"/>
    <nd ref="0"/>
    <nd ref="0"/>
    <nd ref="1251325411"/>
    <nd ref="0"/>
    <nd ref="0"/>
    <nd ref="0"/>
    <nd ref="2454247856"/>
</way></pre></div></blockquote>

<p>I suspect that it might be due to OsmWriters since I checked the generated GeoDataPlacemark of merged buildings and these were having legitimate longitude, latitude values.</p>

<p>Also, the regionQuery() method, which queries neighboring buildings for cluster formation purposes, has a runtime of O(n) due to which our clustering takes O(n*n) time. As discussed with <a href="https://phabricator.kde.org/p/nienhueser/" style="
              border-color: #f1f7ff;
              color: #19558d;
              background-color: #f1f7ff;
                border: 1px solid transparent;
                border-radius: 3px;
                font-weight: bold;
                padding: 0 4px;" rel="noreferrer">@nienhueser</a>, Once we get the output right i.e. correctly merged buildings , regionQuery() can be optimized by using Quadtrees or R-Trees.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>rMARBLE Marble</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D2376" rel="noreferrer">https://phabricator.kde.org/D2376</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>tools/osm-simplify/BuildingBlock.cpp<br />
tools/osm-simplify/BuildingBlock.h<br />
tools/osm-simplify/BuildingCluster.cpp<br />
tools/osm-simplify/BuildingCluster.h<br />
tools/osm-simplify/BuildingDensityClustering.cpp<br />
tools/osm-simplify/BuildingDensityClustering.h<br />
tools/osm-simplify/BuildingMerger.cpp<br />
tools/osm-simplify/BuildingMerger.h<br />
tools/osm-simplify/CMakeLists.txt<br />
tools/osm-simplify/TagsFilter.h<br />
tools/osm-simplify/main.cpp</div></div></div><br /><div><strong>EMAIL PREFERENCES</strong><div><a href="https://phabricator.kde.org/settings/panel/emailpreferences/" rel="noreferrer">https://phabricator.kde.org/settings/panel/emailpreferences/</a></div></div><br /><div><strong>To: </strong>tandon, rahn, nienhueser<br /><strong>Cc: </strong>nienhueser, Marble, marble-devel<br /></div>