Opened 9 years ago
Last modified 5 years ago
#9758 new Feature Requests
boost::geometry::index::rtree does not compile with CoordinateSystem geographic<
Reported by: | Owned by: | Barend Gehrels | |
---|---|---|---|
Milestone: | To Be Determined | Component: | geometry |
Version: | Boost 1.55.0 | Severity: | Problem |
Keywords: | Cc: |
Description
boost::geometry::index::rtree does not compile with CoordinateSystem geographic<
CoordinateSystem cartesian is ok
Example program:
typedef bg::model::point<double, 2, bg::cs::cartesian> geo_point_ok; typedef bg::model::point<double, 2, bg::cs::geographic<bg::degree> > geo_point; typedef std::pair<geo_point, unsigned int> geo_vg_value; void test() { double lon=10.0, lat=60.0; geo_point pt(on, lat); rtree.insert(std::make_pair(pt, wp->id)); std::vector<geo_vg_value> result; geo_point here(targetLat, targetLat); rtree.query(bgi::nearest(here, 20), std::back_inserter(result)); }
Change History (5)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Type: | Bugs → Feature Requests |
---|
comment:3 by , 7 years ago
Is there a workaround in the meantime?
That is how do I tell Boost.Geometry to derive the distance between two points in the geographic coordinate system? From an implementation standpoint, I think this should be easily doable using e.g. the Haversine formula.
Is there a quick fix that lets the RTree work with (longitude, latitude)-pairs or similar in the geographical coordinate system?
comment:4 by , 6 years ago
If haversine distance is good for you, instead of geographic CS you could use spherical_equatorial.
comment:5 by , 5 years ago
You need a point to MBR distance: https://link.springer.com/chapter/10.1007/978-3-642-40235-7_9
In 1.56 the geometry::comparable_distance() is used by the nearest query. After adding the support for geographic CS in this algorithm the rtree should work automatically.