Boost C++ Libraries: Ticket #9759: boost::geometry::index::rtree does not work properly spherical_equatorial https://svn.boost.org/trac10/ticket/9759 <p> When spherical_equatorial coordinate system is used with index::rtree, the query(nearest) gives wrong results. </p> <p> My example insert 30.000 waypoint and query(nearest) mostly returns point east of the query point. When using cartesian, it works ok, except for the expected domain mismatch. Tested with boost 1.55.0 on Linux with g++ 4.4.3 and g++ 4.6.3 (identical results). The attached map plots shows the results from the two tests (cartesian and spherical_equatorial). Full source code, inclduing all waypoint data available upon request. </p> <pre class="wiki">typedef bg::model::point&lt;double, 2, bg::cs::cartesian&gt; geo_point_ok; typedef bg::model::point&lt;double, 2, bg::cs::spherical_equatorial&lt;bg::degree&gt; &gt; geo_point; typedef std::pair&lt;geo_point, unsigned int&gt; geo_vg_value; void test() { double lon=10.0, lat=60.0 geo_point pt(lon, lat); rtree.insert(std::make_pair(pt, wp-&gt;id)); std::vector&lt;geo_vg_value&gt; result; geo_point here(targetLat, targetLat); rtree.query(bgi::nearest(here, 20), std::back_inserter(result)); } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9759 Trac 1.4.3 anonymous Sat, 08 Mar 2014 20:43:47 GMT attachment set https://svn.boost.org/trac10/ticket/9759 https://svn.boost.org/trac10/ticket/9759 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-geometry-with-cartesian.jpg</span> </li> </ul> <p> Result from query(nearest) with cartesian </p> Ticket anonymous Sat, 08 Mar 2014 20:44:45 GMT attachment set https://svn.boost.org/trac10/ticket/9759 https://svn.boost.org/trac10/ticket/9759 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-geometry-with-spherical.jpg</span> </li> </ul> <p> Result from query(nearest) with spherical_equatorial </p> Ticket awulkiew Sat, 12 Jul 2014 00:33:55 GMT <link>https://svn.boost.org/trac10/ticket/9759#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9759#comment:1</guid> <description> <p> The geometry::comparable_distance() is now used in the rtree nearest query so this should be fixed. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>awulkiew</dc:creator> <pubDate>Mon, 25 Aug 2014 12:40:36 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/9759 https://svn.boost.org/trac10/ticket/9759 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">spherical_equatorial.cpp</span> </li> </ul> <p> Test file finding the nearest neighborsusing the rtree and std::sort() </p> Ticket awulkiew Mon, 25 Aug 2014 14:13:48 GMT status, version changed; resolution set https://svn.boost.org/trac10/ticket/9759#comment:2 https://svn.boost.org/trac10/ticket/9759#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost 1.55.0</span> → <span class="trac-field-new">Boost 1.56.0</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> I attached a test file containing the code searching for the nearest neighbours using the rtree and std::sort(). The input data contains the values for which the query failed for the user plus a big number of random values. The result is the same in both cases. </p> <p> Furthermore I'm guessing that the problem isn't caused by the way how comparable_distance() was calculated. Before 1.56 the cartesian comparable_distance() was always used so the result of a query should be the same as for the cartesian Points. But since this behavior was invalid I'm closing this ticket as 'fixed', not 'worksforme'. </p> Ticket awulkiew Mon, 25 Aug 2014 14:14:21 GMT version changed https://svn.boost.org/trac10/ticket/9759#comment:3 https://svn.boost.org/trac10/ticket/9759#comment:3 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.56.0</span> → <span class="trac-field-new">Boost 1.55.0</span> </li> </ul> Ticket