[geos-devel] Problem with convex hull generating bad polygons (I think)
mtnclimb at telus.net
Tue Apr 16 22:45:21 PDT 2013
ConvexHull does not require validity of the input - it only operates on
the raw vertices of the input. And it should always produce a valid
output (which will be a polygon in the case of three or more
Could the TopologyException come from the Union operation, not the
ConvexHull? Union definitely *does* require valid inputs, and if the
inputs are not valid it almost always throws a TopologyException.
On 4/16/2013 11:53 AM, Richard Frith-Macdonald wrote:
> 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.
> geos-devel mailing list
> geos-devel at lists.osgeo.org
More information about the geos-devel