Uses DBSCAN clustering algorithm to identify building clusters and then merges these clusters using QPolygonF::united() method.
However, the buildings are not getting correctly written in the output OSM file.
We are getting buildings of the form
<way id="237536278" changeset="31318507" timestamp="2015-05-20T15:41:52Z" uid="35468" user="Blunauer" version="2" visible="true">
<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>
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.
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 @nienhueser, Once we get the output right i.e. correctly merged buildings , regionQuery() can be optimized by using Quadtrees or R-Trees.