Comments (3)
The strategy has to be available for the compiler. You shouldn't be forced to pass it explicitly into the centroid()
function but the header must be included. Including either of these should fix it:
#include <boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp>
or (file including all strategies):
#include <boost/geometry/strategies/strategies.hpp>
or (file including all algorithms and strategies):
#include <boost/geometry.hpp>
Note that the default strategy for cartesian 2d areal geometries is defined here: https://github.com/boostorg/geometry/blob/develop/include/boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp#L236
This is how Boost.Geometry is designed. If it worked before exactly with the headers you have in the example this was a coincidence.
from geometry.
Including centroid_bashein_detmer.hpp or strategies.hpp like you said fixed the issue.
In that case I believe the documentation should mention one of these includes is needed to define the strategy or a user has to create his own. Right now there is no mention of strategies on return_centroid page. There is a table with behaviors, but it isn't explained how they connect to the default stategy.
The compiler errors also don't make it obvious to deduce that a working default strategy is already defined elsewhere.
If you agree, I could try creating a pull request with changes to documentation to make it easier for others trying to use return_centroid.
While I was browsing docs and sources I also stumbled upon strange inconsistencies.
I can see return_centroid (with strategy) page lists only Bashein-Detmer as available one. Strategies page on the other hand contains one additional - centroid average. But in the sources there is also centroid weighted length.
Is that normal that the last one is not linked anywhere and the "return_centroid (with strategy)" mentions only one strategy?
from geometry.
Of course any help is appreciated. If you're willing to improve documentation I'll gladly review your pull requests and help you in case you had any problems.
There are some inconsistencies and omissions for sure like the lack of strategies mentioned on algorithms pages, lack of examples, pictures, supported coordinate systems (strategies implemented for this coordinate system) etc.
However note that your problem with headers is more general. This is how all algorithms and strategies work. So as general case it could be described in the "Compilation" section, probably under "Advanced Includes". Because AFAIU the standard way of including Boost.Geometry is to include everything with #include <boost/geometry.hpp>
and only if you want to do something special and are knowledgeable enough include only needed parts of the library.
Indeed describing the default strategies on return_centroid
(or any algorithm) page could be helpful. And indeed on the return_centroid (with_strategies)
page there is only 1 strategy mentioned. But then I'm not so sure if this is a good place to describe which headers exactly should be included in order to include certain strategy, this info should rather be on the strategy page. However it would be helpful if it was clear which strategies are the default ones for which geometries and coordinate system exactly and that you have to include them if you wanted to use them with the algorithm.
from geometry.
Related Issues (20)
- within returns a wrong result with multi-linestrings
- static assertion failed: Not implemented for this Geometry's coordinate system HOT 1
- difference returns wrong results if double is the data type HOT 1
- Difference returns wrong result if hole touch the boundary of subtrahend HOT 2
- [Question] Get edges intersected with bounding boxes using boost::geometry::index::intersects HOT 2
- `boost::geometry::buffer()` of linestring returns inner polygon HOT 3
- Intersection gives incorrect result for polygon and line HOT 1
- Difference failed on two simple integer multi polygons (integral geometries cannot represent non-integral vertices/intersections) HOT 7
- Compilation Error with Boost.Geometry and NVCC (CUDA 12.4): '__T0' does not name a type HOT 3
- Buffer gives incorrect result for negative distance HOT 2
- wkt do not duplicate first point at the end for "non closed" ring HOT 3
- VS2015(C++14 partly) cannot use this geometry HOT 1
- rtree extern template instantiation with interprocess compile error
- Union of a multipolygon and a polygon outputs empty multipolygon HOT 4
- Cannot make 'point_on_surface' compile HOT 4
- Incorrect results for geometries or inputs in geographic coordinate system at the edges longitude-latitude range HOT 7
- 1.80+ - Buffer out-then-in for round polygon produces multiple polygons with small "stubs" HOT 2
- Test libraries and executables should be declared EXCLUDE_FROM_ALL
- Negative buffer on MultiPolygon loses precision in area calculation HOT 5
- Type/Value mismatch in the point_xy.hpp file HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geometry.