On Thu, 3 Oct 2019 at 18:04, Giorgino R via Boost-users
Is there any boost functionality to "split" a linestring with an intersecting point?
I'm not aware of any such algorithm in Boost.Geometry.
I was expecting that boost::geometry::intersection could return a multi-linestring (of size two) or a vector of linestrings (size two).
That would be a different algorithm, presumably split, but not intersection according to OGC. Mind you, the Boost.Geometry documentation at https://www.boost.org/libs/geometry/doc/html/geometry/reference/algorithms/i... says "The function intersection implements function Intersection from the OGC Simple Feature Specification.", what is similar to PostGIS, https://postgis.net/docs/ST_Intersection.html. The OGC Simple Feature Specification says the algorithm returns point set intersection of input geometries.
For example, please see a very simple case below which doesn't compile:
point_2d pt(0.5, 0); linestring_2d ls({ point_2d(0, 0), point_2d(1, 0), point_2d(3, 0), point_2d(5, 0) }); std::vector
inter; bg::intersection(pt, ls, inter); Is there any way to get inter vector with two linestrings (...) or any multi geometry container that will hold the spatial information of two lines connected in this point? Or should I create these two lines myself by working out which points of the linestring are left and right of the intersecting point?
There is a way and yes you need to build a solution your self,
but it should be not a hair-pulling experience using the building blocks
provided by Boost.Geometry.
For example, here is a quick example with possible solution:
```
#include