Offset buffer to another geometry

130 Views Asked by At

I am using the NetTopologySuite library. We have a buffer curve from LineString at a certain distance, in this case it is 5 units. The drawing also contains regions.

My problem is to attract buffer points to region points if they are at a distance less than the specified one, for example 2.5 units.

Original scheme

The result I want to get

Of course, there is an option to check each point, but it is not very effective in my case, since I have tens of thousands of such points on the diagram. To more efficiently pass and find the closest points I used a Quad Tree, maybe there is a way to connect these points more efficiently?

1

There are 1 best solutions below

1
FObermaier On BEST ANSWER

I'd suggest you perform the follwing steps:

  1. Union all your regions into one geometry.
  2. Build a large rectangle geometry from an envelope containing the unioned regions and the linestring. This should be enlarged by the maximum buffer distance used for step 4.
  3. Build the difference of the large rectangle and the unioned regions.
  4. Build the intersection of the difference with the buffered linestring. Use a realistic maximum buffer distance value.
  5. Clean the result of unwanted spikes or other artefacts