question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
randallwhitmancommented, May 14, 2018

Need to merge the branch for this before releasing. Also, rather than a 2.1.1 I’d release 2.2.0 with Centroid and this one.

1reaction
stolstovcommented, May 11, 2018

@mbasmanova Yes, sure. Do you have more bugs to find 😃? @randallwhitman Would need to do a minor release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

21 Spatial Aggregate Functions - Oracle Help Center
The following example returns the convex hull of the geometry objects in the COLA_MARKETS table. (The example uses the definitions and data from...
Read more >
geometryEngine | ArcGIS API for JavaScript 4.25
Calculates the convex hull of one or more geometries. A convex hull is the smallest convex polygon that encloses a group of geometries...
Read more >
Why is my convex hull algorithm returning the wrong points?
I'm writing some Python for Autodesk Maya that should return the 2D convex hull for a given 3D polygon.
Read more >
Class Geometry | NetTopologySuite - NTS Topology Suite
The buffer operation always returns a polygonal result. The negative or zero-distance buffer of lines and points is always an empty IPolygonal. This...
Read more >
Release Notes - 1.72.0 - Boost C++ Libraries
557 Invalid result of distance between point and linestring in spherical-equatorial ... 596 boost::geometry::buffer generates (multi)polygon with spike.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found