Hi,

Thanks in advance for your help.

I have a simple program using boost rtree library. The 2D bounding box is rectangle and the query point is the middle point of the left or right edge. 

If I use geographic coordinate system, query middle left edge returns nothing, yet query middle right edge return the bounding box.

If I used cartesian coordinate system, query middle points returns the bounding box in both cases.

Could anyone shed some light why query in the geographic coordinate system behaves differently than in cartesian? Also why query the left edge and right edge behave differently in geographic coordinate system?

Best Regards,
Eric

---- simple program ---

// example file to test boost.

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/point.hpp>

#include <boost/geometry/index/rtree.hpp>

// to store queries results
#include <vector>

// just for output
#include <boost/foreach.hpp>
#include <iostream>

namespace bg = boost::geometry;
namespace bgi = boost::geometry::index;

// If we use geographic coordinate system, the left edge middle point query
// returns vector with 0 element.
//
// If we use geographic coordinate system, the left edge middle point query
// returns vector with 1 element.
//
// typedef bg::model::point<double, 2, bg::cs::cartesian> point;
typedef bg::model::point<double, 2, bg::cs::geographic<bg::degree>> point;
typedef bg::model::box<point> box;
typedef std::pair<box, unsigned> value;

int main(int argc, char* argv[]) {
// create the rtree using default constructor
bgi::rtree<value, bgi::quadratic<16>> rtree;

point sw(-122.18, 37.38), ne(-122.16, 37.39);

box b(sw, ne);
rtree.insert(std::make_pair(b, 1));

point check_point(-122.18, 37.385);

std::vector<value> result_s;
rtree.query(
boost::geometry::index::covers(check_point),
std::back_inserter(result_s));

// display results
std::cout << "spatial query point:" << std::endl;
std::cout << check_point.get<0>() << ", " << check_point.get<1>()
<< std::endl;

std::cout << "spatial query result:" << std::endl;
BOOST_FOREACH (value const& v, result_s)
std::cout << bg::wkt<box>(v.first) << " - " << v.second << std::endl;

return 0;
}