Skip to content

OGCGeometry#convexHull returns incorrect results for points on a single line #172

@mbasmanova

Description

@mbasmanova

I'm seeing convexHull method returning incorrect results for some inputs:

  • fails if input geometry is empty, but I expect to get empty geometry back
  • returns empty geometry if input is a single point, but I expect to get the original point back
  • returns corrupt geometry if all points are on the same line, but I expect to get a LINESTRING geometry back
  • fails if input is a geometry collection where some of the geometries are empty

For MULTIPOINT (1 1, 2 2) input, the output is corrupt:

com.esri.core.geometry.GeometryException: corrupted geometry

	at com.esri.core.geometry.OperatorExportToWktLocal.exportPolygonToWkt(OperatorExportToWktLocal.java:111)
	at com.esri.core.geometry.OperatorExportToWktLocal.exportToWkt(OperatorExportToWktLocal.java:47)
	at com.esri.core.geometry.OperatorExportToWktLocal.execute(OperatorExportToWktLocal.java:31)
	at com.esri.core.geometry.GeometryEngine.geometryToWkt(GeometryEngine.java:274)
	at com.esri.core.geometry.ogc.OGCMultiPolygon.asText(OGCMultiPolygon.java:53)

Here is the error for empty geometry.

com.esri.core.geometry.GeometryException: This operation should not be performed on an empty geometry.

	at com.esri.core.geometry.Point.getXY(Point.java:102)
	at com.esri.core.geometry.ConvexHull.addPoint_(ConvexHull.java:375)
	at com.esri.core.geometry.ConvexHull.addGeometry(ConvexHull.java:68)
	at com.esri.core.geometry.OperatorConvexHullCursor.calculateConvexHullMerging_(OperatorConvexHullCursor.java:79)
	at com.esri.core.geometry.OperatorConvexHullCursor.next(OperatorConvexHullCursor.java:49)
	at com.esri.core.geometry.ogc.OGCGeometry.createFromEsriCursor(OGCGeometry.java:512)
	at com.esri.core.geometry.ogc.OGCGeometry.createFromEsriCursor(OGCGeometry.java:505)
	at com.esri.core.geometry.ogc.OGCGeometry.convexHull(OGCGeometry.java:448)

CC: @tpeng-fb

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions