A relative easy way to support non-filled QRect is to use the LineString concept. To avoid overhead of a allocations std::array could be used. Based on the intial code, the following parts need to be added: #include <array> using RectLineString = std::array<QPoint, 5>; BOOST_GEOMETRY_REGISTER_LINESTRING(RectLineString) double distance(const QPoint &p, const QRect...

It turned out that the problem wasn't related to OGR and Boost using two different algorithms. Instead, it was my adapter code that was to blame. More specifically, the iterator facade I wrote in order to adapt OGRLineString, OGRLinearRing and ultimately OGRPolygon to the Boost.Geometry code. I posted a question...

In my humble opionion, Boost geometry is not proper for high arbitrary dimension points (i.e., dimension > 4). Nevertheless, points with high arbitrary dimension are supported due to its generic nature. The compiler is rightfully complaining about not knowing point since you haven't define it anywhere. Solution: Use template...

Make sure your input geometries satisfy the pre-conditions documented. You can use bg::correct to fix most issues (such as proper CCW ordering of points in the polygon, closing unclosed polygons etc.): Live On Coliru #include <boost/geometry/core/cs.hpp> #include <boost/geometry/geometries/point.hpp> #include <boost/geometry/geometries/ring.hpp> #include <boost/geometry/geometries/box.hpp> #include <boost/geometry/geometries/segment.hpp> #include <boost/geometry/geometries/linestring.hpp> #include...

As an alternative approach I thought you should be able to adapt the Boost Geometry point model as a Fusion sequence. Live On Coliru #include <iostream> namespace bg = boost::geometry; namespace fus = boost::fusion; int main() { bg::model::point<double, 7, bg::cs::cartesian> p1; // set some nice values p1.set<0>(7); p1.set<1>(14); p1.set<2>(21); p1.set<3>(28);...

c++,performance,ubuntu-14.04,r-tree,boost-geometry

A mapped file will behave mostly like regular memory (in fact, in Linux, memory allocation with new or malloc will use mmap [with a "no file" backing storage] as the underlying allocation method). However, if you do many small writes "all over the place", and you are mapping over a...

When you use bg::model::polygon<point, false, true> you are defining a polygon that uses point as its point type, that has its points in counter clockwise order and that is closed (meaning that its last point is equal to its first). If you either "close" your polygon or use an open...

c++,boost,geometry,gis,boost-geometry

The extensions are a part of the development version of a library, they're not released. So in order to use them you should probably checkout/clone (and use) the development version of Boost.Geometry. You could also try to mix the released version and the extensions from the development version but I'm...

c++,performance,boost,boost-geometry

Since boost is using templates, it needs to make sure that the return type has sufficient precision. Imagine if the input Points had integer values for X and Y - the result needs more than integer precision. Also, a result of float would be insufficient precision if the input Point...

c++,c++11,boost,boost-geometry

Update to the comment If the worry was about the temporary vector in the first place, just don't use one. You can use the qbegin()/qend() free functions from boost::geometry::index: std::vector<std::shared_ptr<VeryImportantInfo> > Catalogue::FindIn(float x1, float y1, float x2, float y2) { box query_box(point(x1, y1), point(x2, y2)); auto b = bgi::qbegin(rtree, bgi::intersects(query_box)),...

As stated here: The point order is defined for any geometry type, but only has a real meaning for areal geometry types (ring, polygon, multi_polygon) As for the polygon concept, there are some rules written here: If the polygons underlying ring_type is defined as clockwise, the exterior ring must have...

In Boost.Geometry the algorithm proposed by Bashein and Detmer [1] is used by default for the calculation of a centroid of Areal Geometries. The reason is that the simple average method fails for a case where many closely spaced vertices are placed at one side of a Polygon. [1] Gerard...

c++,boost,memory-mapped-files,boost-geometry

Internally the R-tree can use various types of nodes, though the interface of defining and choosing them is not documented and probably will never be. In Boost 1.56 the default type of nodes was changed to variant-based exactly because of the issue you're facing. So to use the rtree with...

The Boost.Geometry rtree implementation supports stateful allocators. E.g. it's possible to use it with Boost.Interprocess to store the rtree in shared memory or mapped file. If you were able to implement an allocator saving/loading nodes to/from files and allowing access to data when a pointer returned by this allocator is...

c++,multithreading,boost,r-tree,boost-geometry

Is Boost.Geometry.index.rtree thread safe in any way? No If not, what would be the optimal approach to use it with multiple threads in a safe manner (e.g. mutex lock between insert() calls? Optimal? Depends. You need mutual exclusion. You can do this with spinlocks, simple mutex, shared/upgradable mutex etc....

Just set the output precision on the stream, e.g. std::cout << std::setprecision(12) << boost::geometry::wkt(newPoly); This is a lot simpler. You don't have to do the whole buffer dance either! Live On Coliru #include <iostream> #include <vector> #include <boost/geometry.hpp> #include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/polygon.hpp> #include <boost/geometry/io/wkt/wkt.hpp> #include <boost/foreach.hpp> int main() { typedef...