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.

383 questions
4
votes
1 answer

Problems in adapting a geometry object model using boost geometry

I tried to follow the example given by https://www.boost.org/doc/libs/1_75_0/libs/geometry/doc/html/geometry/examples/example__adapting_a_legacy_geometry_object_model.html for the following immutable pointerless variant. #include…
4
votes
2 answers

using boost::geometry to convert from Latitude and longitude to UTM

boost::geometry seems to have support to convert from lat/lon to UTM. Unfortunately I couldn't find any example on how exactly to do that. Does someone have an example they are willing to share?
jpo234
  • 419
  • 3
  • 9
4
votes
2 answers

How to use boost::geometry::rtree with glm::vec3 as a custom point type?

I'm using BOOST_GEOMETRY_REGISTER_POINT_3D(glm::vec3, float, boost::geometry::cs::cartesian, x, y, z); with an RTree defined as: using IndexedPoint = std::pair; using RTree = boost::geometry::index::rtree
BuschnicK
  • 5,304
  • 8
  • 37
  • 49
4
votes
1 answer

Boost Geometry Matrix Transformations on Polygons

Are there any examples of matrix transformations on polygons (cartesian), using Boost Geometry? I am defining the matrix with simple std::vectors. Also, I could only find 1 example of matrix_transformers using ublas but it's way too convoluted for a…
Jaime Ivan Cervantes
  • 3,579
  • 1
  • 40
  • 38
4
votes
1 answer

Cannot remove element from boost::geometry::index::rtree by its index

I'm creating a boost geometry rtree. From the sample page I create: typedef bg::model::point point; typedef bg::model::box box; typedef std::pair value; I want to add value elements to the…
Jepessen
  • 11,744
  • 14
  • 82
  • 149
4
votes
0 answers

MySQL 5.7: Invalid GIS data

The following query seems to be working just fine under MySQL 5.6 (returns 0 for the Area), but on MySQL 5.7 it returns an error saying ERROR 3037 (22023): Invalid GIS data provided to function st_area.. SELECT ST_Area(GeomFromText('POLYGON((0 0, 0…
uri2x
  • 3,162
  • 1
  • 11
  • 25
4
votes
1 answer

Boost::geometry How do you add polygons to a multi_polygon

I want to create a boost::geometry::model::multi_polygon by adding boost::geometry::model::polygons to it in a loop. I've looked through boost's examples and documentation but they are unclear how to do it. Here is the code I have typedef…
Matthew Lueder
  • 953
  • 2
  • 12
  • 25
4
votes
1 answer

C++ Boost Geometry error: no matching function for call to 'assertion_failed'

I am trying to test if a Polygon is contained within another Polygon using Boost library. I just started writing my code using this as an example, and got a massive compile error even before I could begin my main block. (It was so massive SO threw…
pr4n
  • 2,918
  • 3
  • 30
  • 42
4
votes
0 answers

Boost Geometry doesn't copy the attributes of my custom point class

I am attempting to use Boost Geometry with a custom vertex class that has x, y and many parameters for rendering such as texture coordinates. I registered the custom class using BOOST_GEOMETRY_REGISTER_POINT_2D and the algorithms such as union_…
4
votes
2 answers

boost::geometry Most efficient way of measuring max/min distance of a point to a polygon ring

I have been using boost::geometry library in a program, mostly for handling polygon objects. I am now trying to optimize my code to scale better with larger polygons. One my functions checks for a given polygon and a given point (usually inside the…
Learning is a mess
  • 7,479
  • 7
  • 35
  • 71
4
votes
2 answers

c ++ Boost Loop through dimensions of model::point

I was wondering if there was a way to loop through the dimensions of a boost point model. I am trying to create a function to do calculations on two custom points, with a definable number of dimensions. In other words the number of dimensions of…
Zack Frost
  • 155
  • 1
  • 12
4
votes
1 answer

Boost::geometry query returning indexes

I want to have class, which uses boost::geometry::index::rtree for spatial indexers. This class alone should know about boost, so I use something like this: struct VeryImportantInfo { ... float x; float y; } class Catalogue { …
DoctorMoisha
  • 1,613
  • 14
  • 25
4
votes
1 answer

what's the difference between ring and polygon in boost geometry?

I'm confused about ring and polygon in Boost.Geometry. In the documentation, there's no figure showing what is a ring, and what is a polygon. Can anyone draw a figure explaining the difference between two concepts?
4
votes
1 answer

Boost Geometry and exact point types

I am currently working on a project which deals with geometric problems. Since this project will be used commercially I cannot use libraries like CGAL. I am currently using boost::geometry with inexact types but I encountered numeric issues. I tried…
4
votes
1 answer

Why boost::geometry::intersection does not work correct?

I wrote next test function for Boost Geometry intersection function typedef boost::geometry::model::polygon > Polygon; void test_boost_intersection() { Polygon green, blue; boost::geometry::read_wkt("POLYGON((0 0,0 9,9…
aptypr
  • 417
  • 5
  • 15
1 2
3
25 26