[geos-devel] Problem with convex hull generating bad polygons (I think)
Richard Frith-Macdonald
richard at tiptree.demon.co.uk
Tue Apr 16 11:53:28 PDT 2013
Sorry, this is not really a developer question, but I don't know where else to ask.
I might be encountering a bug, but most likely I'm just misunderstanding and doing something wrong.
I have code which is failing with 'TopologyException:side location conflict at' errors when performing a convex hull operation using the C API.
Adding diagnostics to print the WKT of things before the operation, it looks like I'm feeding in an invalid polygon (one with repeated points), but I don't know why.
My code starts (as far as I can tell) with valid simple (ie no inner rings) polygons, and attempts top merge/extend some of them as follows:
In some cases, I want one polygon to be extended to include another ... I do a union of the two and then a convex hull of the result, using this to replace the original polygon.
In other cases, I want one polygon to be extended to touch another ... I calculate the nearest points on the two polygons and then union the first polygon with the closest point of the second polygon, and do a convex hull of the union, using it to replace the first polygon.
I think one of these operations must be producing an invalid polygon as its output, and then that is causing the topology exception later on when the output of one pass is used as input in a later pass.
So, my guess is I'm doing something stupid here ... should the convex hull operation always produce a valid polygon as output?
Is a union of two polygons not valid as input for convex hull?
Is a union of a polygon and a point not valid for input for convex hull?
Thanks in advance for any help.
More information about the geos-devel
mailing list