Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in validity (report) (was: multipolygon buffer result either invalid geometry or valid geometry but wrong) #1192

Open
gastald88 opened this issue Aug 28, 2023 · 6 comments
Assignees

Comments

@gastald88
Copy link

I want to buffer of a small amount the multipolygon in the following picture (I apologize if it is quite complicated, I tried to replicate the issue in a simpler shape but I could not make it):

image

When applying the buffer algorithm, I have encountered two problems:

  1. if the buffer amount is 0.05, we obtain an invalid geometry due to self-intersections in the external border;
  2. if the buffer amount is 0.050005, we obtain a valid geometry, but the result is wrong (see image below).
    image

Here below a godbolt link to replicate this problem:
https://godbolt.org/z/vM9ex7MrW

@barendgehrels
Copy link
Collaborator

Can you please use it without #define BOOST_GEOMETRY_ROBUSTNESS_ALTERNATIVE
This is not supposed to be used by library users
(maybe it was suggested here once, but that was erroneous).
Can you remove the define?

@barendgehrels
Copy link
Collaborator

barendgehrels commented Aug 29, 2023

Just did it myself.

Program returned: 0
Using Boost 1.83.0
is poly valid? true

buffer amount: 0.05
is buffered poly valid? false
validity check message: Geometry has invalid self-intersections. A self-intersection point was found at (1292.86, 1471.84); method: i; operations: i/u; segment IDs {source, multi, ring, segment}: {0, 0, -1, 259}/{0, 0, -1, 262}

buffer amount: 0.050005
is buffered poly valid? true
validity check message: Geometry is valid

So the report looks still the same.

@barendgehrels
Copy link
Collaborator

Adding area, report is now:

buffer amount: 0.05000000000000000278
area 4015945.12599748093634843826
is buffered poly valid? false
validity check message: Geometry has invalid self-intersections. A self-intersection point was found at (1292.86, 1471.84); method: i; operations: i/u; segment IDs {source, multi, ring, segment}: {0, 0, -1, 259}/{0, 0, -1, 262}

buffer amount: 0.05000500000000000084
area 4015945.17474469868466258049
is buffered poly valid? true
validity check message: Geometry is valid

It seems like the buffer has the same shape for both distances (still reporting one as invalid)

Added:
<< std::fixed << std::setprecision(20)
and, per buffer
<< "area " << boost::geometry::area(buffered_poly) << std::endl

@gastald88
Copy link
Author

Can you please use it without #define BOOST_GEOMETRY_ROBUSTNESS_ALTERNATIVE This is not supposed to be used by library users (maybe it was suggested here once, but that was erroneous). Can you remove the define?

Thank you for the reply.

As you said, I defined that macro as suggested in another issue of mine (see issue #1138), since that actually solved the problem. Do you think I should anyway remove the definition of BOOST_GEOMETRY_ROBUSTNESS_ALTERNATIVE and wait for future fixes of #1138 not concerning such macro?

@barendgehrels
Copy link
Collaborator

It is not yet fixed, unlike #1138
Yes, please remove the define BOOST_GEOMETRY_ROBUSTNESS_ALTERNATIVE, it is deprecated
The validity check might be a false positive in this case. Therefore I'm not closing this issue. But the buffer itself looks reasonable.

@barendgehrels barendgehrels self-assigned this Sep 14, 2023
@gastald88
Copy link
Author

perfect, thank you very much for the update.

@barendgehrels barendgehrels changed the title multipolygon buffer result either invalid geometry or valid geometry but wrong Error in validity (report) (was: multipolygon buffer result either invalid geometry or valid geometry but wrong) Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants