last day (14 days later) » 

12:21 AM
0
A: boost read_wkt produced invalid polygon

sehePrinting the reason helps: std::string reason; std::cout << (bg::is_valid(in, reason)?"valid ":"invalid ") << reason << std::endl; Prints invalid Geometry has invalid self-intersections. A self-intersection point was found at (9064.33, 177.811); method: t; operations: x/i; segment IDs {source...

 
I do not understand why is there an intersection in the first place?
 
I dunno. Have you tried visualizing? Are the inner rings correctly oriented (reverse direction from the outer rings)?
 
Yes. The polygon is definitely valid and the points do not overlap. They are very close. Is there a resolution issue somewhere?
 
Could be. Do you have the visualisation to share? I'm not big on reading WKT
Added a visualization: i.stack.imgur.com/5yguN.png I'd say the two inner rings might be too close, indeed. Here's with the stroke-width to 0: i.stack.imgur.com/CEmMA.png
 
The rectangle ends at X coordinate 9064.333999999999 and the rectilinear polygon begins at X coordinate 9064.3340000000007. While close, they do not overlap. This WKT was produced by Shapely and Python subtracting the union of the two inner polygons (when they were polygons and not holes) from the larger rectangle. I would have thought it is a representation issue, but then LLDB prints the points as truly having different representation. Thus my question if there is any resolution that's being enforced.
 
12:21 AM
It's clearly not being enforced. However, floating point representations are inexact, and hence the calculations are lossy with a certain margin of error.
A fix: Live On Coliru (see answer update)
in Discussion between David R. and sehe, 1 hour ago, by David R.
I posted the details in this question https://stackoverflow.com/questions/44578414/boost-read-wkt-produced-invalid-pol‌​ygon, since I am too stupid to figure out how to edit an existing question.
Since you're apparently new to so, please see meta.stackexchange.com/questions/5234/…
 
This helped, but just moved the problem elsewhere: "Geometry has invalid self-intersections. A self-intersection point was found at (1.96819e-232, 999.906); method: i; operations: i/u; segment IDs {source, multi, ring, segment}: {0, 0, -1, 1}/{0, 0, -1, 4}"
 
Again, you're providing only partial clues.
I fully believe you that you were able to get an error. You should by now be able to predict the cause.
I fully understand if you want to complain with the library authors about the limited usefulness of the library with inexact float input data, but that's about it.
 
12:55 AM
Remember when you accused me of downvoting you? I think I'm done putting effort into this.
In all real senses of the word I did answer the question. It's not "moved the problem elsewhere", as you can see in the live example.
Good luck.
 
I'm sorry about that. Yes, you did answer my question. I appreciate the effort you put into this with me!
 
@DavidR. Ok cheers! I thought you had moved on :)
Good night. Its 3am here
 

last day (14 days later) »