Questions tagged [boost-geometry]

Boost.Geometry is a template C++ library, included in Boost. It contains geometry classes (such as point, linestring, polygon) and functions (such as distance, intersection, union). Boost.Geometry is Concept based and users can use their own models of e.g. point.

Boost.Geometry (aka Generic Geometry Library, GGL), part of collection of the Boost C++ Libraries, defines concepts, primitives and algorithms for solving geometry problems.

Boost.Geometry contains a dimension-agnostic, coordinate-system-agnostic and scalable kernel, based on concepts, meta-functions and tag dispatching. On top of that kernel, algorithms are built: area, length, perimeter, centroid, convex hull, intersection (clipping), within (point in polygon), distance, envelope (bounding box), simplify, transform, and much more. The library supports high precision arithmetic numbers, such as ttmath.

Boost.Geometry contains instantiable geometry classes, but library users can also use their own. Using registration macros or traits classes their geometries can be adapted to fulfill Boost.Geometry concepts.

Boost.Geometry might be used in all domains where geometry plays a role: mapping and GIS, game development, computer graphics and widgets, robotics, astronomy and more. The core is designed to be as generic as possible and support those domains. Currently, the development has been mostly GIS-oriented.

More information on the Documentation.

Download from Boost download page.

Source code is also available at GitHub.

Contact developers at the Boost.Geometry mailing list or Boost-users mailing list.

348 questions
19
votes
2 answers

is Boost.Geometry mature enough?

I've been recently hired by a GIS company to rewrite their old geomatics libraries. So I'm currently looking for a good computational geometry library. I've seen CGAL, which is amazing, but my boss wants something free. So I'm now checking…
undu
  • 2,001
  • 2
  • 17
  • 27
12
votes
3 answers

How do I include Boost libraries?

I'm trying to incorporate the Boost libraries into my program, specifically lexical_cast and geometry. I include them using #include"boost/boost/geometry.hpp" and #include"boost/boost/lexical_cast/lexical_cast_old.hpp". When I run the code I get…
Peter
  • 163
  • 1
  • 1
  • 6
12
votes
2 answers

boost::geometry: nearest neighbors using a circle

I am using the Rtree implementation of boost::geometry to store (lots of) 2D points. Now I need to do distance-based nearest neigbors queries. However, the manual only describes queries as rectangular boxes (i.e. "Get me all the points that are…
kebs
  • 4,983
  • 3
  • 36
  • 61
11
votes
2 answers

Boost::Geometry: how to join intersecting polygons in a multi_polygon?

So I want to join all interrelated poligons in a multi_polygon. How to do such thing? We have such image (of one green multi_polygon) which we want to optimize (we can see yellow doted lines - result of simplification that apparently was performed…
Rella
  • 59,216
  • 102
  • 341
  • 614
11
votes
1 answer

error C2678: binary '==' : no operator found which takes a left-hand operand of type (or there is no acceptable conversion)

I'm trying to compile the following code: #include #include #include typedef boost::geometry::model::d2::point_xy Point; typedef std::pair Vector; bool…
Andrey Dyatlov
  • 762
  • 1
  • 5
  • 12
10
votes
1 answer

How to combine two Boost Geometry transformers?

I have two transformers, a translation and a rotation as follows: namespace bg = boost::geometry; namespace trans = bg::strategy::transform; trans::translate_transformer translate(px, py); trans::rotate_transformer
Nestor
  • 2,607
  • 2
  • 26
  • 32
10
votes
2 answers

Getting the coordinates of points from a Boost Geometry polygon

I have a simple DLL doing some calculations with Boost Geometry polygons. (Mostly intersections and differences.) Since the DLL will be most likely called from C# code, and from Delphi and who knows from where else, I should convert the result into…
ytg
  • 1,647
  • 2
  • 23
  • 38
9
votes
1 answer

Boost::Geometry union simplification - how it works?

There is great library for geometry in Boost. It allows also to draw SVG images. I want to use it in some project of mine but it works really strange for me (see image below). So we have 3 pixel points represented as square poligons in 2d space 1…
Rella
  • 59,216
  • 102
  • 341
  • 614
8
votes
1 answer

Why boost.geometry.index.rtree is slower than superliminal.RTree

I test boost.geometry.index.rtree (boost 1.59 www.boost.org) and superliminal.RTree (http://superliminal.com/sources/sources.htm#C_Code). To my surprise, superliminal.RTree is more quickly than boost.geometry.index.rtree. Environment settings add…
zadecn
  • 129
  • 1
  • 6
8
votes
3 answers

What is the fastest way to create the union of many boost::polygons?

I have to union many boost::polgons, but my approach does not seem very performant (>15 min), especially with larger numbers of polygons (>2000). I push all the polygons i want to union into a multipolygon and then join the multipolygon, see my…
ffranz
  • 103
  • 1
  • 4
8
votes
3 answers

Transforming a boost::geometry polygon into an STL object

How do I get a boost::geometry polygon into an STL object? I am sure this must be simple because I cannot find examples anywhere in the documentation. Yet I have spent about 4 full work days trying to do this tiny thing. I am new to C++ (long time R…
politicalEconomist
  • 981
  • 1
  • 12
  • 19
7
votes
1 answer

Boost 1.65.1 geometry distance strategy compile error with Visual Studio 2017

When trying to compile my project with new version of boost 1.65.1, I get the following error: C:\Users\twozn\Dev\soundtoolkit\stk\libraries\boost/geometry/strategies/distance.hpp(101): error C2664: 'int…
tomi.lee.jones
  • 1,503
  • 1
  • 15
  • 20
7
votes
1 answer

Do Boost Geometry nearest queries always sort results ordered by smallest distance first?

I have made a few simple Cartesian Point to Point tests: rtree.qbegin(bgi::nearest(Point(4, 4), 2)) and they were sorted in Boost 1.61. Now I'd like a documentation or source quote to confirm it. If not, I will just sort the query output myself…
7
votes
1 answer

Boost : persistent storage of R-trees?

So boost provides nice spatial indexing capabilities in the form of R-trees. This is neat, however it doesn't seem possible yet to serialize the tree once it is built, am I wrong? The usual "out_archive << rtree" syntax doesn't work because rtree…
jerorx
  • 506
  • 3
  • 17
7
votes
1 answer

Boost Library and closest points

I can find the distance between a point MyPoint and a polygon MyPolygon with double dist = boost::geometry::distance(MyPoint, MyPolygon) obviously the actual closest point on MyPolygon has to be computed somewhere. Is there an easy way to get that…
user3049681
  • 267
  • 3
  • 11
1
2 3
23 24